You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2005/08/18 07:11:45 UTC

cvs commit: xml-xalan/c/src/xalanc/XSLT KeyTable.cpp Stylesheet.cpp StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp

dbertoni    2005/08/17 22:11:45

  Modified:    c/src/xalanc/XSLT KeyTable.cpp Stylesheet.cpp
                        StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
  Log:
  Fixes for Jira issue XALANC-115.
  
  Revision  Changes    Path
  1.10      +14 -36    xml-xalan/c/src/xalanc/XSLT/KeyTable.cpp
  
  Index: KeyTable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/KeyTable.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- KeyTable.cpp	29 Apr 2005 21:39:44 -0000	1.9
  +++ KeyTable.cpp	18 Aug 2005 05:11:45 -0000	1.10
  @@ -100,47 +100,25 @@
               {
                   const KeyDeclaration&   kd = keyDeclarations[i];
   
  -                if (executionContext.getInConstruction(kd) == true)         
  -                {
  -                    assert(kd.getURI() != 0);
  -                    StylesheetExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
  -
  -                    throw XSLTProcessorException(
  -                            executionContext.getMemoryManager(),
  -                            XalanMessageLoader::getMessage(
  -                                theGuard.get(),
  -                                XalanMessages::UseOfFunctionIsIllegal_2Param,
  -                                "key()",
  -                                "xsl:key"),
  -                            *kd.getURI(),
  -                            kd.getLineNumber(),
  -                            kd.getColumnNumber());
  -                }
  -                else
  -                {
  -                    executionContext.beginConstruction(kd);
  -
  -                    // See if our node matches the given key declaration according to 
  -                    // the match attribute on xsl:key.
  -                    assert(kd.getMatchPattern() != 0);
  -
  -                    const XPath::eMatchScore    score =
  -                            kd.getMatchPattern()->getMatchScore(testNode,
  -                                                                resolver,
  -                                                                executionContext);
  +                // See if our node matches the given key declaration according to 
  +                // the match attribute on xsl:key.
  +                assert(kd.getMatchPattern() != 0);
   
  -                    if(score != XPath::eMatchScoreNone)
  -                    {
  -                        processKeyDeclaration(
  -                            m_keys,
  -                            kd,
  +                const XPath::eMatchScore    score =
  +                        kd.getMatchPattern()->getMatchScore(
                               testNode,
                               resolver,
                               executionContext);
  -                    }
   
  -                    executionContext.endConstruction(kd);
  -                } // if (kd.getInConstruction() == true)
  +                if(score != XPath::eMatchScoreNone)
  +                {
  +                    processKeyDeclaration(
  +                        m_keys,
  +                        kd,
  +                        testNode,
  +                        resolver,
  +                        executionContext);
  +                }
               } // end for(int i = 0; i < nDeclarations; ++i)
   
               ++nodeIndex;
  
  
  
  1.20      +6 -2      xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Stylesheet.cpp	29 Apr 2005 21:39:44 -0000	1.19
  +++ Stylesheet.cpp	18 Aug 2005 05:11:45 -0000	1.20
  @@ -288,7 +288,9 @@
                       constructionContext.createMatchPattern(
                           0,
                           theBuffer,
  -                        nsContext);
  +                        nsContext,
  +                        false,
  +                        false);
           }
           else if(equals(aname, Constants::ATTRNAME_USE))
           {
  @@ -296,7 +298,9 @@
                       constructionContext.createXPath(
                           0,
                           atts.getValue(i),
  -                        nsContext);
  +                        nsContext,
  +                        false,
  +                        false);
           }
           else if (isAttrOK(aname, atts, i, constructionContext) == false)
           {
  
  
  
  1.9       +19 -5     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StylesheetConstructionContext.hpp	8 Nov 2004 18:18:56 -0000	1.8
  +++ StylesheetConstructionContext.hpp	18 Aug 2005 05:11:45 -0000	1.9
  @@ -272,13 +272,17 @@
   	 * @param locator the locator for the XPath. May be null.
   	 * @param str string to match
   	 * @param resolver resolver for namespace resolution
  +     * @param allowVariableReferences If true, variable references are allowed.
  +     * @param allowKeyFunction If true, calls to the key() function are allowed.
   	 * @return XPath for match pattern
   	 */
   	virtual XPath*
   	createMatchPattern(
   			const LocatorType*		locator,
   			const XalanDOMString&	str,
  -			const PrefixResolver&	resolver) = 0;
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true) = 0;
   
   	/**
   	 * Create and initialize an xpath for a match pattern and return it. This
  @@ -288,13 +292,17 @@
   	 * @param locator the locator for the XPath. May be null.
   	 * @param str string to match
   	 * @param resolver resolver for namespace resolution
  +     * @param allowVariableReferences If true, variable references are allowed.
  +     * @param allowKeyFunction If true, calls to the key() function are allowed.
   	 * @return XPath for match pattern
   	 */
   	virtual XPath*
   	createMatchPattern(
   			const LocatorType*		locator,
   			const XalanDOMChar*		str,
  -			const PrefixResolver&	resolver) = 0;
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true) = 0;
   
   	/**
   	 * Create and initialize an xpath and return it. This is to be used by
  @@ -310,7 +318,9 @@
   	createXPath(
   			const LocatorType*		locator,
   			const XalanDOMString&	str,
  -			const PrefixResolver&	resolver) = 0;
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true) = 0;
   
   	/**
   	 * Create and initialize an xpath and return it. This is to be used by
  @@ -326,7 +336,9 @@
   	createXPath(
   			const LocatorType*		locator,
   			const XalanDOMChar*		str,
  -			const PrefixResolver&	resolver) = 0;
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true) = 0;
   
   	/**
   	 * Create and initialize an xpath and return it. This is to be used by
  @@ -343,7 +355,9 @@
   			const LocatorType*			locator,
   			const XalanDOMChar*			str,
   			XalanDOMString::size_type	len,
  -			const PrefixResolver&		resolver) = 0;
  +			const PrefixResolver&		resolver,
  +            bool                        allowVariableReferences = true,
  +            bool                        allowKeyFunction = true) = 0;
   
   	/**
   	 * Get the locator from the top of the locator stack.
  
  
  
  1.14      +39 -10    xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetConstructionContextDefault.cpp	29 Apr 2005 21:39:44 -0000	1.13
  +++ StylesheetConstructionContextDefault.cpp	18 Aug 2005 05:11:45 -0000	1.14
  @@ -403,7 +403,9 @@
   StylesheetConstructionContextDefault::createMatchPattern(
               const LocatorType*      locator,
               const XalanDOMString&   str,
  -            const PrefixResolver&   resolver)
  +            const PrefixResolver&   resolver,
  +            bool                    allowVariableReferences,
  +            bool                    allowKeyFunction)
   {
       XPath* const    xpath = m_xpathFactory.create();
   
  @@ -417,7 +419,9 @@
               *this,
               str,
               resolver,
  -            getLocatorFromStack());
  +            getLocatorFromStack(),
  +            allowVariableReferences,
  +            allowKeyFunction);
   
       xpath->setInStylesheet(true);
   
  @@ -432,13 +436,20 @@
   StylesheetConstructionContextDefault::createMatchPattern(
               const LocatorType*      locator,
               const XalanDOMChar*     str,
  -            const PrefixResolver&   resolver)
  +            const PrefixResolver&   resolver,
  +            bool                    allowVariableReferences,
  +            bool                    allowKeyFunction)
   {
       assert(str != 0);
   
       assign(m_tempBuffer, str);
   
  -    return createMatchPattern(locator, m_tempBuffer, resolver);
  +    return createMatchPattern(
  +                locator,
  +                m_tempBuffer,
  +                resolver,
  +                allowVariableReferences,
  +                allowKeyFunction);
   }
   
   
  @@ -447,7 +458,9 @@
   StylesheetConstructionContextDefault::createXPath(
               const LocatorType*      locator,
               const XalanDOMString&   str,
  -            const PrefixResolver&   resolver)
  +            const PrefixResolver&   resolver,
  +            bool                    allowVariableReferences,
  +            bool                    allowKeyFunction)
   {
       XPath* const    xpath = m_xpathFactory.create();
   
  @@ -461,7 +474,9 @@
               *this,
               str,
               resolver,
  -            getLocatorFromStack());
  +            getLocatorFromStack(),
  +            allowVariableReferences,
  +            allowKeyFunction);
   
       xpath->setInStylesheet(true);
   
  @@ -476,13 +491,20 @@
   StylesheetConstructionContextDefault::createXPath(
               const LocatorType*      locator,
               const XalanDOMChar*     str,
  -            const PrefixResolver&   resolver)
  +            const PrefixResolver&   resolver,
  +            bool                    allowVariableReferences,
  +            bool                    allowKeyFunction)
   {
       assert(str != 0);
   
       assign(m_tempBuffer, str);
   
  -    return createXPath(locator, m_tempBuffer, resolver);
  +    return createXPath(
  +                locator,
  +                m_tempBuffer,
  +                resolver,
  +                allowVariableReferences,
  +                allowKeyFunction);
   }
   
   
  @@ -492,13 +514,20 @@
               const LocatorType*          locator,
               const XalanDOMChar*         str,
               XalanDOMString::size_type   len,
  -            const PrefixResolver&       resolver)
  +            const PrefixResolver&       resolver,
  +            bool                        allowVariableReferences,
  +            bool                        allowKeyFunction)
   {
       assert(str != 0);
   
       assign(m_tempBuffer, str, len);
   
  -    return createXPath(locator, m_tempBuffer, resolver);
  +    return createXPath(
  +                locator,
  +                m_tempBuffer,
  +                resolver,
  +                allowVariableReferences,
  +                allowKeyFunction);
   }
   
   
  
  
  
  1.10      +20 -10    xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StylesheetConstructionContextDefault.hpp	8 Nov 2004 18:18:56 -0000	1.9
  +++ StylesheetConstructionContextDefault.hpp	18 Aug 2005 05:11:45 -0000	1.10
  @@ -234,32 +234,42 @@
   	createMatchPattern(
   			const LocatorType*		locator,
   			const XalanDOMString&	str,
  -			const PrefixResolver&	resolver);
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true);
   
   	virtual XPath*
   	createMatchPattern(
   			const LocatorType*		locator,
   			const XalanDOMChar*		str,
  -			const PrefixResolver&	resolver);
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true);
   
   	virtual XPath*
   	createXPath(
   			const LocatorType*		locator,
   			const XalanDOMString&	str,
  -			const PrefixResolver&	resolver);
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true);
   
   	virtual XPath*
   	createXPath(
  -			const LocatorType*			locator,
  -			const XalanDOMChar*			str,
  -			XalanDOMString::size_type	len,
  -			const PrefixResolver&		resolver);
  +			const LocatorType*		locator,
  +			const XalanDOMChar*		str,
  +			const PrefixResolver&	resolver,
  +            bool                    allowVariableReferences = true,
  +            bool                    allowKeyFunction = true);
   
   	virtual XPath*
   	createXPath(
  -			const LocatorType*		locator,
  -			const XalanDOMChar*		str,
  -			const PrefixResolver&	resolver);
  +			const LocatorType*			locator,
  +			const XalanDOMChar*			str,
  +			XalanDOMString::size_type	len,
  +			const PrefixResolver&		resolver,
  +            bool                        allowVariableReferences = true,
  +            bool                        allowKeyFunction = true);
   
   	virtual const LocatorType*
   	getLocatorFromStack() const;
  
  
  
  1.29      +0 -26     xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- StylesheetExecutionContext.hpp	2 May 2005 19:33:48 -0000	1.28
  +++ StylesheetExecutionContext.hpp	18 Aug 2005 05:11:45 -0000	1.29
  @@ -75,7 +75,6 @@
   class FormatterListener;
   class FormatterToText;
   class GenerateEvent;
  -class KeyDeclaration;
   class PrefixResolver;
   class NodeRefListBase;
   class NodeSorter;
  @@ -1739,31 +1738,6 @@
               XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
   
       /**
  -     * Determine if a KeyDeclaration is being constructed.
  -     *
  -     * @param The KeyDeclaration in question.
  -     * @return true if being constructed
  -     */
  -    virtual bool
  -    getInConstruction(const KeyDeclaration&     keyDeclaration) const = 0;
  -
  -    /**
  -     * Add KeyDeclaration to construction list.
  -     * 
  -     * @param KeyDeclaration being constructed
  -     */
  -    virtual void
  -    beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 
  -
  -    /**
  -     * Remove KeyDeclaration from construction list.
  -     * 
  -     * @param constructed KeyDeclaration
  -     */
  -    virtual void
  -    endConstruction(const KeyDeclaration& keyDeclaration) = 0;
  -
  -    /**
        * Create a PrintWriter for the provided stream.
        * 
        * @param theTextOutputStream The output stream for the PrintWriter.
  
  
  
  1.45      +6 -31     xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- StylesheetExecutionContextDefault.cpp	18 Aug 2005 01:07:07 -0000	1.44
  +++ StylesheetExecutionContextDefault.cpp	18 Aug 2005 05:11:45 -0000	1.45
  @@ -120,7 +120,6 @@
       m_paramsVector(theManager),
       m_matchPatternCache(theManager),
       m_keyTables(theManager),
  -    m_keyDeclarationSet(theManager),
       m_countersTable(theManager),
       m_sourceTreeResultTreeFactory(),
       m_mode(0),
  @@ -184,7 +183,6 @@
       m_paramsVector(theManager),
       m_matchPatternCache(theManager),
       m_keyTables(theManager),
  -    m_keyDeclarationSet(theManager),
       m_countersTable(theManager),
       m_sourceTreeResultTreeFactory(),
       m_mode(0),
  @@ -770,8 +768,7 @@
   void
   StylesheetExecutionContextDefault::beginParams()
   {
  -    ParamsVectorType  newParamsVector (getMemoryManager());
  -    m_paramsVectorStack.push_back(newParamsVector);
  +    m_paramsVectorStack.resize(m_paramsVectorStack.size() + 1);
   }
   
   
  @@ -786,15 +783,17 @@
       m_paramsVectorStack.pop_back();
   }
   
  -    
  +
   
   void
   StylesheetExecutionContextDefault::pushParam(
           const XalanQName& qName,
           const XObjectPtr& theValue)
   {
  -    ParamsVectorType& currentParamVector = m_paramsVectorStack.back();
  -    
  +    assert(m_paramsVectorStack.empty() == false);
  +
  +    ParamsVectorType&   currentParamVector = m_paramsVectorStack.back();
  +
       currentParamVector.push_back(ParamsVectorType::value_type(&qName, theValue));
   }
   #endif
  @@ -1827,30 +1826,6 @@
   
   
   
  -bool
  -StylesheetExecutionContextDefault::getInConstruction(const KeyDeclaration&  keyDeclaration) const
  -{
  -    return m_keyDeclarationSet.count(&keyDeclaration) != 0 ? true : false;
  -}
  -
  -
  -
  -void
  -StylesheetExecutionContextDefault::beginConstruction(const KeyDeclaration&  keyDeclaration)
  -{   
  -    m_keyDeclarationSet.insert(&keyDeclaration);
  -}
  -
  -    
  -
  -void
  -StylesheetExecutionContextDefault::endConstruction(const KeyDeclaration&    keyDeclaration)
  -{
  -    m_keyDeclarationSet.erase(&keyDeclaration);
  -}
  -
  -
  -
   void
   StylesheetExecutionContextDefault::reset()
   {
  
  
  
  1.39      +0 -12     xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- StylesheetExecutionContextDefault.hpp	10 Jun 2005 17:44:33 -0000	1.38
  +++ StylesheetExecutionContextDefault.hpp	18 Aug 2005 05:11:45 -0000	1.39
  @@ -101,7 +101,6 @@
       typedef XalanVector<XalanOutputStream*>             OutputStreamVectorType;
   
       typedef XalanVector<const ElemTemplateElement*> ElementTemplateElementStackType;
  -    typedef XalanSet<const KeyDeclaration*> KeyDeclarationSetType;
       typedef XALAN_STD_QUALIFIER pair<const XPath*, ClockType>       XPathCacheEntry;
       typedef XalanMap <XalanDOMString, XPathCacheEntry>              XPathCacheMapType;
       typedef XalanVector<const ElemTemplate*>            CurrentTemplateStackType;
  @@ -771,15 +770,6 @@
       FormatNumberFunctor*
       uninstallFormatNumberFunctor();
   
  -    virtual bool
  -    getInConstruction(const KeyDeclaration&     keyDeclaration) const;
  -
  -    virtual void
  -    beginConstruction(const KeyDeclaration&     keyDeclaration);
  -
  -    virtual void
  -    endConstruction(const KeyDeclaration&   keyDeclaration);
  -
       virtual PrintWriter*
       createPrintWriter(XalanOutputStream*        theTextOutputStream);
   
  @@ -1141,8 +1131,6 @@
   
       KeyTablesTableType                  m_keyTables;
   
  -    KeyDeclarationSetType               m_keyDeclarationSet;
  -
       CountersTable                       m_countersTable;
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org