dbertoni    2002/09/20 18:24:43

  Modified:    c/src/XSLT AVT.cpp AVT.hpp AVTPart.hpp AVTPartSimple.cpp
                        AVTPartSimple.hpp ElemAttribute.cpp
                        ElemAttributeSet.cpp ElemCallTemplate.cpp
                        ElemDecimalFormat.cpp ElemElement.cpp
                        ElemExtensionCall.cpp ElemExtensionCall.hpp
                        ElemIf.cpp ElemLiteralResult.cpp
                        ElemLiteralResult.hpp ElemNumber.cpp ElemPI.cpp
                        ElemSort.cpp ElemTemplateElement.cpp
                        ElemTemplateElement.hpp ElemTextLiteral.cpp
                        ElemTextLiteral.hpp FunctionKey.cpp KeyTable.cpp
                        KeyTable.hpp ResultNamespacesStack.cpp
                        ResultNamespacesStack.hpp
                        StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetHandler.cpp StylesheetHandler.hpp
                        StylesheetRoot.cpp StylesheetRoot.hpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Performance tweaks and new functionality.
  
  Revision  Changes    Path
  1.17      +21 -45    xml-xalan/c/src/XSLT/AVT.cpp
  
  Index: AVT.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AVT.cpp   6 May 2002 05:31:57 -0000       1.16
  +++ AVT.cpp   21 Sep 2002 01:24:41 -0000      1.17
  @@ -109,6 +109,10 @@
   
   
   
  +const XalanDOMString AVT::s_emptyString;
  +
  +
  +
   /**
    * Construct an AVT by parsing the string, and either 
    * constructing a vector of AVTParts, or simply hold 
  @@ -117,16 +121,13 @@
   AVT::AVT(
                        const Locator*                                  locator,
                        const XalanDOMChar*                             name,
  -                     const XalanDOMChar*                             type,
                        const XalanDOMChar*                             
stringedValue,
                        const PrefixResolver&                   resolver,
                        StylesheetConstructionContext&  constructionContext) :
                m_parts(),
  -             m_simpleString(),
  -             // $$$ ToDo: Explicit XalanDOMString constructor
  -             m_name(XalanDOMString(name)),
  -             m_prefix(getPrefix(name)),
  -             m_pcType(type)
  +             m_simpleString(0),
  +             m_simpleStringLength(0),
  +             m_name(constructionContext.getPooledString(name))
   {
        StringTokenizer         tokenizer(stringedValue, 
theTokenDelimiterCharacters, true);
   
  @@ -134,7 +135,9 @@
   
        if(nTokens < 2)
        {
  -             m_simpleString = stringedValue; // then do the simple thing
  +             // Do the simple thing
  +             m_simpleStringLength = length(stringedValue);
  +             m_simpleString = 
constructionContext.allocateVector(stringedValue, m_simpleStringLength, false);
        }
        else
        {
  @@ -183,7 +186,7 @@
                                                {
                                                        if(length(buffer) > 0)
                                                        {
  -                                                             
m_parts.push_back(new AVTPartSimple(buffer));
  +                                                             
m_parts.push_back(new AVTPartSimple(constructionContext, c_wstr(buffer), 
length(buffer)));
   
                                                                clear(buffer);
                                                        }
  @@ -310,19 +313,14 @@
   
                if(length(buffer) > 0)
                {
  -                     m_parts.push_back(new AVTPartSimple(buffer));
  +                     m_parts.push_back(new 
AVTPartSimple(constructionContext, c_wstr(buffer), length(buffer)));
   
                        clear(buffer);
                }
   
        } // end else nTokens > 1
   
  -     if(m_parts.empty() && length(m_simpleString) == 0)
  -     {
  -             // Error?
  -             clear(m_simpleString);
  -     }
  -     else if (m_parts.size() < m_parts.capacity())
  +     if (m_parts.size() < m_parts.capacity())
        {
                AVTPartPtrVectorType(m_parts).swap(m_parts);
        }
  @@ -346,30 +344,23 @@
   
   
   void
  -AVT::evaluate(
  +AVT::doEvaluate(
                        XalanDOMString&                 buf,
                        XalanNode*                              contextNode,
                        const PrefixResolver&   prefixResolver,
                        XPathExecutionContext&  executionContext) const
   {
  -     if(length(m_simpleString) > 0)
  -     {
  -             buf = m_simpleString;
  -     }
  -     else
  +     clear(buf);
  +
  +     if(m_parts.empty() == false)
        {
  -             clear(buf);
  +             const AVTPartPtrVectorType::size_type   n = m_parts.size();
   
  -             if(m_parts.empty() == false)
  +             for(AVTPartPtrVectorType::size_type i = 0; i < n; i++)
                {
  -                     const AVTPartPtrVectorType::size_type   n = 
m_parts.size();
  -
  -                     for(AVTPartPtrVectorType::size_type i = 0; i < n; i++)
  -                     {
  -                             assert(m_parts[i] != 0);
  +                     assert(m_parts[i] != 0);
   
  -                             m_parts[i]->evaluate(buf, contextNode, 
prefixResolver, executionContext);
  -                     }
  +                     m_parts[i]->evaluate(buf, contextNode, prefixResolver, 
executionContext);
                }
        }
   }
  @@ -393,20 +384,5 @@
        else
        {
                tokenizer.nextToken(token);
  -     }
  -}
  -
  -
  -
  -XalanDOMString
  -AVT::getPrefix(const XalanDOMChar*   theName)
  -{
  -     if (startsWith(theName, DOMServices::s_XMLNamespaceWithSeparator) == 
true)
  -     {
  -             return XalanDOMString(theName, 
DOMServices::s_XMLNamespaceWithSeparatorLength);
  -     }
  -     else
  -     {
  -             return XalanDOMString();
        }
   }
  
  
  
  1.14      +33 -55    xml-xalan/c/src/XSLT/AVT.hpp
  
  Index: AVT.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AVT.hpp   7 Dec 2001 19:58:10 -0000       1.13
  +++ AVT.hpp   21 Sep 2002 01:24:41 -0000      1.14
  @@ -101,7 +101,6 @@
         *
         * @param ownerElement            the Locator for the AVT.  May be null.
         * @param name                name of AVT
  -      * @param type                type of AVT
         * @param stringedValue       string value to parse
         * @param resolver            resolver for namespace resolution
         * @param constructionContext context for construction of AVT
  @@ -109,7 +108,6 @@
        AVT(
                        const Locator*                                  locator,
                        const XalanDOMChar*                             name,
  -                     const XalanDOMChar*                             type,
                        const XalanDOMChar*                             
stringedValue,
                        const PrefixResolver&                   resolver,
                        StylesheetConstructionContext&  constructionContext);
  @@ -128,46 +126,22 @@
                return m_name;
        }
   
  -     /**
  -      * Retrieve the prefix of the name of the Attribute Value Template,
  -      * if any.
  -      * 
  -      * @return The prefix part of the AVT's name
  -      */
  -    const XalanDOMString&
  -     getPrefix() const
  -     {
  -             return m_prefix;
  -     }
  -
  -     /**
  -      * Retrieve the type of the Attribute Value Template
  -      * 
  -      * @return type of AVT
  -      */
  -     const XalanDOMString&
  -     getType() const
  -     {
  -             return m_pcType;
  -     }
  -
  -     /**
  -      * Retrieve the "simple" value
  -      * 
  -      * @return The "simple" value of the AVT.
  -      */
  -     const XalanDOMString&
  -     getSimpleValue() const
  -     {
  -             return m_simpleString;
  -     }
  -
        void
        evaluate(
                        XalanDOMString&                 buf,
                        XalanNode*                              contextNode,
                        const PrefixResolver&   prefixResolver,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext) const
  +     {
  +             if(m_simpleString != 0)
  +             {
  +                     buf.assign(m_simpleString, m_simpleStringLength);
  +             }
  +             else
  +             {
  +                     doEvaluate(buf, contextNode, prefixResolver, 
executionContext);
  +             }
  +     }
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef vector<const AVTPart*>          AVTPartPtrVectorType;
  @@ -178,35 +152,39 @@
   private:
   
        void
  +     doEvaluate(
  +                     XalanDOMString&                 buf,
  +                     XalanNode*                              contextNode,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     void
        nextToken(
                        StylesheetConstructionContext&  constructionContext,
                        const Locator*                                  locator,
                        StringTokenizer&                                
tokenizer,
                        XalanDOMString&                                 token);
   
  -     /**
  -      * Get the prefix from theName, if any.
  -      * 
  -      * @param theName name of AVT
  -      *
  -      * @return A string containing the prefix.
  -      */
  -     XalanDOMString
  -     getPrefix(const XalanDOMChar*   theName);
  -
        // not implemented
  -     AVT(const AVT &);
  -     AVT& operator=(const AVT &);    
  +     AVT(const AVT&);
  +
  +     AVT&
  +     operator=(const AVT&);
  +
  +     bool
  +     operator==(const AVT&) const;
  +
   
  -     AVTPartPtrVectorType    m_parts;
  +     // Data members...
  +     AVTPartPtrVectorType                    m_parts;
   
  -     XalanDOMString                  m_simpleString;
  +     const XalanDOMChar*                             m_simpleString;
   
  -     const XalanDOMString    m_name; 
  +     XalanDOMString::size_type               m_simpleStringLength;
   
  -     const XalanDOMString    m_prefix;
  +     const XalanDOMString&                   m_name;
   
  -     const XalanDOMString    m_pcType;
  +     static const XalanDOMString             s_emptyString;
   };
   
   
  
  
  
  1.5       +2 -6      xml-xalan/c/src/XSLT/AVTPart.hpp
  
  Index: AVTPart.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPart.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AVTPart.hpp       11 Apr 2000 15:09:19 -0000      1.4
  +++ AVTPart.hpp       21 Sep 2002 01:24:41 -0000      1.5
  @@ -69,11 +69,7 @@
   
   
   
  -// $$$ ToDo: This is necessary while XalanDOMString is still a typedef...
  -#include <XalanDOM/XalanDOMString.hpp>
  -
  -
  -
  +class XalanDOMString;
   class XalanNode;
   class PrefixResolver;
   class XPathExecutionContext;
  
  
  
  1.4       +12 -4     xml-xalan/c/src/XSLT/AVTPartSimple.cpp
  
  Index: AVTPartSimple.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartSimple.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AVTPartSimple.cpp 11 Apr 2000 15:09:19 -0000      1.3
  +++ AVTPartSimple.cpp 21 Sep 2002 01:24:41 -0000      1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -62,12 +62,20 @@
   
   
   
  +#include "StylesheetConstructionContext.hpp"
  +
  + 
  + 
   /**
    * Simple string part of a complex AVT.
    */
  -AVTPartSimple::AVTPartSimple(const XalanDOMString&   val) :
  +AVTPartSimple::AVTPartSimple(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const XalanDOMChar*                             val,
  +                     XalanDOMString::size_type               len) :
        AVTPart(),
  -     m_val(val)
  +     m_val(constructionContext.allocateVector(val, len, false)),
  +     m_len(len)
   {
   }
   
  @@ -81,5 +89,5 @@
                        XPathExecutionContext&  /* executionContext */) const
   
   {
  -     append(buf, m_val);
  +     append(buf, m_val, m_len);
   }
  
  
  
  1.5       +14 -4     xml-xalan/c/src/XSLT/AVTPartSimple.hpp
  
  Index: AVTPartSimple.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartSimple.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AVTPartSimple.hpp 11 Apr 2000 15:09:19 -0000      1.4
  +++ AVTPartSimple.hpp 21 Sep 2002 01:24:41 -0000      1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -77,6 +77,10 @@
   
   
   
  +class StylesheetConstructionContext;
  +
  +
  +
   /**
    * Simple string part of a complex AVT.
    */
  @@ -87,9 +91,13 @@
        /**
         * Construct a simple Attribute Value Template (AVT) part.
         *
  +      * @param constructionContext  context when object constructed
         * @param val A pure string section of an AVT
         */
  -     AVTPartSimple(const XalanDOMString&             val);
  +     AVTPartSimple(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const XalanDOMChar*                             val,
  +                     XalanDOMString::size_type               len);
   
   
        // These methods are inherited from AVTPart ...
  @@ -106,7 +114,9 @@
        /**
         * Simple string value;
         */
  -     const XalanDOMString            m_val;
  +     const XalanDOMChar* const                       m_val;
  +
  +     const XalanDOMString::size_type         m_len;
   };
   
   
  
  
  
  1.39      +2 -2      xml-xalan/c/src/XSLT/ElemAttribute.cpp
  
  Index: ElemAttribute.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.cpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ElemAttribute.cpp 9 Jul 2002 06:19:40 -0000       1.38
  +++ ElemAttribute.cpp 21 Sep 2002 01:24:41 -0000      1.39
  @@ -100,12 +100,12 @@
   
                if(equals(aname, Constants::ATTRNAME_NAME))
                {
  -                     m_pNameAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_pNameAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(equals(aname,Constants::ATTRNAME_NAMESPACE))
                {
  -                     m_pNamespaceAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_pNamespaceAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(!(isAttrOK(aname, atts, i, constructionContext) || 
  
  
  
  1.20      +9 -2      xml-xalan/c/src/XSLT/ElemAttributeSet.cpp
  
  Index: ElemAttributeSet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ElemAttributeSet.cpp      20 May 2002 17:58:58 -0000      1.19
  +++ ElemAttributeSet.cpp      21 Sep 2002 01:24:41 -0000      1.20
  @@ -90,7 +90,7 @@
   
                if(equals(aname,Constants::ATTRNAME_NAME))
                {
  -                     m_QName = XalanQNameByValue(atts.getValue(i), 
stylesheetTree.getNamespaces());
  +                     m_QName.set(atts.getValue(i), 
stylesheetTree.getNamespaces());
   
                        stylesheetTree.addAttributeSet(this);
                }
  @@ -104,10 +104,17 @@
                }
        }
   
  -     if(isEmpty(m_QName.getLocalPart()))
  +     if(m_QName.isEmpty() == true)
        {
                constructionContext.error(
                        "xsl:attribute-set must have a 'name' attribute",
  +                     0,
  +                     this);
  +     }
  +     else if (isValidNCName(m_QName.getLocalPart()) == false)
  +     {
  +             constructionContext.error(
  +                     "xsl:attribute-set has an invalid 'name' attribute",
                        0,
                        this);
        }
  
  
  
  1.23      +1 -1      xml-xalan/c/src/XSLT/ElemCallTemplate.cpp
  
  Index: ElemCallTemplate.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ElemCallTemplate.cpp      23 Feb 2002 04:23:16 -0000      1.22
  +++ ElemCallTemplate.cpp      21 Sep 2002 01:24:41 -0000      1.23
  @@ -98,7 +98,7 @@
   
                if(equals(aname, Constants::ATTRNAME_NAME))
                {
  -                     m_templateName = XalanQNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());        
  +                     m_templateName.set(atts.getValue(i), 
getStylesheet().getNamespaces());        
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
                {
  
  
  
  1.10      +1 -1      xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp
  
  Index: ElemDecimalFormat.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemDecimalFormat.cpp     23 Feb 2002 04:23:16 -0000      1.9
  +++ ElemDecimalFormat.cpp     21 Sep 2002 01:24:41 -0000      1.10
  @@ -102,7 +102,7 @@
                {
                        assert(atts.getValue(i) != 0);
   
  -                     m_qname = XalanQNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());;
  +                     m_qname.set(atts.getValue(i), 
getStylesheet().getNamespaces());
                }
                else if(equals(aname, Constants::ATTRNAME_DECIMALSEPARATOR))
                {
  
  
  
  1.39      +2 -2      xml-xalan/c/src/XSLT/ElemElement.cpp
  
  Index: ElemElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ElemElement.cpp   16 May 2002 00:48:20 -0000      1.38
  +++ ElemElement.cpp   21 Sep 2002 01:24:41 -0000      1.39
  @@ -100,12 +100,12 @@
   
                if(equals(aname, Constants::ATTRNAME_NAME))
                {
  -                     m_nameAVT = new AVT(getLocator(), aname,        
atts.getType(i), atts.getValue(i),
  +                     m_nameAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_NAMESPACE))
                {
  -                     m_namespaceAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_namespaceAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext); 
                }
                else if(!(processUseAttributeSets(constructionContext, aname, 
atts, i) ||
  
  
  
  1.11      +3 -2      xml-xalan/c/src/XSLT/ElemExtensionCall.cpp
  
  Index: ElemExtensionCall.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ElemExtensionCall.cpp     9 Mar 2001 16:20:03 -0000       1.10
  +++ ElemExtensionCall.cpp     21 Sep 2002 01:24:41 -0000      1.11
  @@ -59,6 +59,7 @@
   
   
   #include "Constants.hpp"
  +#include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
   
   
  @@ -79,9 +80,9 @@
                                          lineNumber,
                                          columnNumber,
                                          Constants::ELEMNAME_EXTENSIONCALL),
  -     m_name(name),
  +     m_name(constructionContext.getPooledString(name)),
        m_nsh(ns),
  -     m_localPart(localpart)  
  +     m_localPart(constructionContext.getPooledString(localpart))     
   {
   }
   
  
  
  
  1.11      +2 -2      xml-xalan/c/src/XSLT/ElemExtensionCall.hpp
  
  Index: ElemExtensionCall.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ElemExtensionCall.hpp     9 Mar 2001 16:20:03 -0000       1.10
  +++ ElemExtensionCall.hpp     21 Sep 2002 01:24:41 -0000      1.11
  @@ -112,11 +112,11 @@
   
   private:
   
  -     const XalanDOMString    m_name;
  +     const XalanDOMString&   m_name;
   
        ExtensionNSHandler&             m_nsh;
   
  -     const XalanDOMString    m_localPart;
  +     const XalanDOMString&   m_localPart;
   };
   
   
  
  
  
  1.19      +2 -1      xml-xalan/c/src/XSLT/ElemIf.cpp
  
  Index: ElemIf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ElemIf.cpp        6 Sep 2002 01:39:17 -0000       1.18
  +++ ElemIf.cpp        21 Sep 2002 01:24:41 -0000      1.19
  @@ -107,7 +107,8 @@
                {
                        processSpaceAttr(atts, i, constructionContext);
                }
  -             else if (!isAttrOK(aname, atts, i, constructionContext))
  +             else if (!processSpaceAttr(aname, atts, i, constructionContext) 
||
  +                              !isAttrOK(aname, atts, i, constructionContext))
                {
                        constructionContext.error(
                                        "xsl:if has an illegal attribute",
  
  
  
  1.53      +4 -44     xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- ElemLiteralResult.cpp     6 Sep 2002 01:39:17 -0000       1.52
  +++ ElemLiteralResult.cpp     21 Sep 2002 01:24:41 -0000      1.53
  @@ -99,7 +99,7 @@
                        lineNumber,
                        columnNumber,
                        xslToken),
  -     m_elementName(name),
  +     m_elementName(constructionContext.getPooledString(name)),
        m_avts(),
        m_attrCount(0),
        m_hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ? 
true : false)
  @@ -166,7 +166,7 @@
                        if(! processUseAttributeSets(constructionContext, 
aname, atts, i) &&
                                        isAttrOK(aname, atts, i, 
constructionContext))
                        {
  -                             m_avts.push_back(new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),        
  +                             m_avts.push_back(new AVT(getLocator(), aname, 
atts.getValue(i),         
                                                        *this, 
constructionContext));
                        }
                }
  @@ -267,25 +267,6 @@
   
   
   
  -inline void
  -ElemLiteralResult::doAddResultAttribute(
  -                     StylesheetExecutionContext&             
executionContext,
  -                     const XalanDOMString&                   thePrefix,
  -                     const XalanDOMString&                   theName,
  -                     const XalanDOMString&                   theValue) const
  -{
  -     if (isEmpty(thePrefix) == true ||
  -         shouldExcludeResultNamespaceNode(
  -                     theValue) == false)
  -     {
  -             executionContext.addResultAttribute(
  -                             theName, 
  -                             theValue);
  -     }
  -}
  -
  -
  -
   void
   ElemLiteralResult::execute(StylesheetExecutionContext&       
executionContext) const
   {
  @@ -333,20 +314,9 @@
   
                        const XalanDOMString&   theName = avt->getName();
   
  -                     const XalanDOMString&   thePrefix = avt->getPrefix();
  -
  -                     const XalanDOMString&   theSimpleValue = 
avt->getSimpleValue();
  +                     avt->evaluate(theStringedValue, 
executionContext.getCurrentNode(), *this, executionContext);
   
  -                     if (isEmpty(theSimpleValue) == false)
  -                     {
  -                             doAddResultAttribute(executionContext, 
thePrefix, theName, theSimpleValue);
  -                     }
  -                     else
  -                     {
  -                             avt->evaluate(theStringedValue, 
executionContext.getCurrentNode(), *this, executionContext);
  -
  -                             doAddResultAttribute(executionContext, 
thePrefix, theName, theStringedValue);
  -                     }
  +                     executionContext.addResultAttribute(theName, 
theStringedValue);
                }
        }
   
  @@ -417,14 +387,4 @@
        {
                return false;
        }
  -}
  -
  -
  -
  -bool
  -ElemLiteralResult::shouldExcludeResultNamespaceNode(const XalanDOMString&    
theURI) const
  -{
  -     return m_namespacesHandler.shouldExcludeResultNamespaceNode(
  -                             getStylesheet().getXSLTNamespaceURI(),
  -                             theURI);
   }
  
  
  
  1.27      +1 -24     xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
  
  Index: ElemLiteralResult.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ElemLiteralResult.hpp     6 Sep 2002 01:39:17 -0000       1.26
  +++ ElemLiteralResult.hpp     21 Sep 2002 01:24:41 -0000      1.27
  @@ -150,32 +150,9 @@
                        const XalanDOMChar*                             
attrValue);
   
        /**
  -      * Determine if the namespace node should be excluded.
  -      *
  -      * @param theURI The namespace URI.
  -      */
  -     bool
  -     shouldExcludeResultNamespaceNode(const XalanDOMString&  theURI) const;
  -
  -     /**
  -      * Add a result attribute, if necessary.
  -      *
  -      * @param executionContext  The current execution context
  -      * @param thePrefix The prefix of the attribute
  -      * @param theName The name of the attribute.
  -      * @param theValue The value of the attribute.
  -      */
  -     void
  -     doAddResultAttribute(
  -                     StylesheetExecutionContext&             
executionContext,
  -                     const XalanDOMString&                   thePrefix,
  -                     const XalanDOMString&                   theName,
  -                     const XalanDOMString&                   theValue) const;
  -
  -     /**
         * The name of the literal result element.
         */
  -     const XalanDOMString            m_elementName;
  +     const XalanDOMString&           m_elementName;
   
        /**
         * A vector to keep track of the attribute elements.
  
  
  
  1.63      +5 -5      xml-xalan/c/src/XSLT/ElemNumber.cpp
  
  Index: ElemNumber.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- ElemNumber.cpp    9 Sep 2002 18:39:49 -0000       1.62
  +++ ElemNumber.cpp    21 Sep 2002 01:24:41 -0000      1.63
  @@ -168,27 +168,27 @@
                }
                else if(equals(aname, Constants::ATTRNAME_FORMAT))
                {
  -                     m_format_avt = new AVT(getLocator(), aname, 
atts.getType(i),
  +                     m_format_avt = new AVT(getLocator(), aname,
                                                atts.getValue(i), *this, 
constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_LANG))
                {
  -                     m_lang_avt = new AVT(getLocator(), aname, 
atts.getType(i),
  +                     m_lang_avt = new AVT(getLocator(), aname,
                                                atts.getValue(i), *this, 
constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_LETTERVALUE))
                {
  -                     m_lettervalue_avt = new AVT(getLocator(), aname, 
atts.getType(i),
  +                     m_lettervalue_avt = new AVT(getLocator(), aname,
                                                atts.getValue(i), *this, 
constructionContext);
                }
                else if(equals(aname,Constants::ATTRNAME_GROUPINGSEPARATOR))
                {
  -                     m_groupingSeparator_avt = new AVT(getLocator(), aname, 
atts.getType(i),
  +                     m_groupingSeparator_avt = new AVT(getLocator(), aname,
                                                atts.getValue(i), *this, 
constructionContext);
                }
                else if(equals(aname,Constants::ATTRNAME_GROUPINGSIZE))
                {
  -                     m_groupingSize_avt = new AVT(getLocator(), aname, 
atts.getType(i),
  +                     m_groupingSize_avt = new AVT(getLocator(), aname,
                                                atts.getValue(i), *this, 
constructionContext);
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
  
  
  
  1.22      +1 -1      xml-xalan/c/src/XSLT/ElemPI.cpp
  
  Index: ElemPI.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemPI.cpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ElemPI.cpp        9 Jul 2002 06:19:40 -0000       1.21
  +++ ElemPI.cpp        21 Sep 2002 01:24:41 -0000      1.22
  @@ -93,7 +93,7 @@
   
                if(equals(aname, Constants::ATTRNAME_NAME))
                {                       
  -                     m_nameAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_nameAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(isAttrOK(aname, atts, i, constructionContext) == false 
||
  
  
  
  1.14      +6 -6      xml-xalan/c/src/XSLT/ElemSort.cpp
  
  Index: ElemSort.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ElemSort.cpp      29 May 2002 18:21:52 -0000      1.13
  +++ ElemSort.cpp      21 Sep 2002 01:24:41 -0000      1.14
  @@ -101,22 +101,22 @@
                }
                else if(equals(aname, Constants::ATTRNAME_LANG))
                {                       
  -                     m_langAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_langAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_DATATYPE))
                {
  -                     m_dataTypeAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_dataTypeAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_ORDER))
                {
  -                     m_orderAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_orderAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_CASEORDER))
                {
  -                     m_caseOrderAVT = new AVT(getLocator(), aname, 
atts.getType(i), atts.getValue(i),
  +                     m_caseOrderAVT = new AVT(getLocator(), aname, 
atts.getValue(i),
                                *this, constructionContext);
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
  @@ -130,13 +130,13 @@
   
        if(0 == m_dataTypeAVT)
        {
  -             m_dataTypeAVT = new AVT(getLocator(), 
c_wstr(Constants::ATTRNAME_DATATYPE), c_wstr(Constants::ATTRTYPE_CDATA), 
c_wstr(Constants::ATTRVAL_DATATYPE_TEXT), 
  +             m_dataTypeAVT = new AVT(getLocator(), 
c_wstr(Constants::ATTRNAME_DATATYPE), c_wstr(Constants::ATTRVAL_DATATYPE_TEXT), 
                        *this, constructionContext);
        }
   
        if(0 == m_orderAVT)
        {
  -             m_orderAVT = new AVT(getLocator(), 
c_wstr(Constants::ATTRNAME_ORDER),   c_wstr(Constants::ATTRTYPE_CDATA), 
c_wstr(Constants::ATTRVAL_ORDER_ASCENDING),
  +             m_orderAVT = new AVT(getLocator(), 
c_wstr(Constants::ATTRNAME_ORDER), c_wstr(Constants::ATTRVAL_ORDER_ASCENDING),
                        *this, constructionContext);
        }
   
  
  
  
  1.77      +23 -22    xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- ElemTemplateElement.cpp   6 Sep 2002 01:39:18 -0000       1.76
  +++ ElemTemplateElement.cpp   21 Sep 2002 01:24:41 -0000      1.77
  @@ -97,6 +97,7 @@
   #include "ElemCallTemplate.hpp"
   #include "ElemForEach.hpp"
   #include "ElemTemplate.hpp"
  +#include "ElemTextLiteral.hpp"
   #include "NamespacesHandler.hpp"
   #include "NodeSorter.hpp"
   #include "Stylesheet.hpp"
  @@ -115,7 +116,7 @@
   
   
   ElemTemplateElement::ElemTemplateElement(
  -                     StylesheetConstructionContext&  /* constructionContext 
*/,
  +                     StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber,
  @@ -136,7 +137,7 @@
        m_previousSibling(0),
        m_firstChild(0),
        m_surrogateChildren(*this),
  -     m_baseIndentifier(stylesheetTree.getCurrentIncludeBaseIdentifier()),
  +     
m_baseIndentifier(constructionContext.getPooledString(stylesheetTree.getCurrentIncludeBaseIdentifier())),
        m_optimizationFlags(eCanGenerateAttributes),
        m_locatorProxy(*this)
   {
  @@ -358,16 +359,16 @@
   {
        if (hasSingleTextChild() == true)
        {
  -             assert(m_firstChild != 0);
  +             assert(m_textLiteralChild != 0);
   
  -             return m_firstChild->getNodeValue();
  +             assign(result, m_textLiteralChild->getText(), 
m_textLiteralChild->getLength());
        }
        else
        {
                doChildrenToString(executionContext, result);
  -
  -             return result;
        }
  +
  +     return result;
   }
   
   
  @@ -379,19 +380,19 @@
   {
        if (hasSingleTextChild() == true)
        {
  -             assert(m_firstChild != 0);
  -
                executionContext.addResultAttribute(
  -                     theName,
  -                     m_firstChild->getNodeValue());
  +                             theName,
  +                             m_textLiteralChild->getText());
        }
        else
        {
                StylesheetExecutionContext::GetAndReleaseCachedString   
theResult(executionContext);
   
  +             childrenToString(executionContext, theResult.get());
  +
                executionContext.addResultAttribute(
  -                     theName,
  -                     doChildrenToString(executionContext, theResult.get()));
  +                             theName,
  +                             theResult.get());
        }
   }
   
  @@ -402,15 +403,15 @@
   {
        if (hasSingleTextChild() == true)
        {
  -             assert(m_firstChild != 0);
  -
  -             executionContext.comment(c_wstr(m_firstChild->getNodeValue()));
  +             executionContext.comment(m_textLiteralChild->getText());
        }
        else
        {
                StylesheetExecutionContext::GetAndReleaseCachedString   
theResult(executionContext);
   
  -             
executionContext.comment(c_wstr(doChildrenToString(executionContext, 
theResult.get())));
  +             childrenToString(executionContext, theResult.get());
  +
  +             executionContext.comment(c_wstr(theResult.get()));
        }
   }
   
  @@ -423,19 +424,19 @@
   {
        if (hasSingleTextChild() == true)
        {
  -             assert(m_firstChild != 0);
  -
                executionContext.processingInstruction(
  -                     c_wstr(theTarget),
  -                     c_wstr(m_firstChild->getNodeValue()));
  +                             c_wstr(theTarget),
  +                             m_textLiteralChild->getText());
        }
        else
        {
                StylesheetExecutionContext::GetAndReleaseCachedString   
theResult(executionContext);
   
  +             childrenToString(executionContext, theResult.get());
  +
                executionContext.processingInstruction(
  -                     c_wstr(theTarget),
  -                     c_wstr(doChildrenToString(executionContext, 
theResult.get())));
  +                             c_wstr(theTarget),
  +                             c_wstr(theResult.get()));
        }
   }
   
  
  
  
  1.46      +3 -1      xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
  
  Index: ElemTemplateElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- ElemTemplateElement.hpp   6 Sep 2002 01:39:18 -0000       1.45
  +++ ElemTemplateElement.hpp   21 Sep 2002 01:24:41 -0000      1.46
  @@ -88,6 +88,7 @@
   
   class AttributeList;
   class ElemTemplate;
  +class ElemTextLiteral;
   class NamespacesHandler;
   class Stylesheet;
   class StylesheetConstructionContext;
  @@ -818,11 +819,12 @@
        {
                ElemTemplateElement*    m_firstChild;
                const ElemTemplate*     m_directTemplate;
  +             const ElemTextLiteral*  m_textLiteralChild;
        };
   
        XalanNodeListSurrogate  m_surrogateChildren;
   
  -     const XalanDOMString    m_baseIndentifier;
  +     const XalanDOMString&   m_baseIndentifier;
   
        enum { eHasParams = 1,
                   eHasSingleTextChild = 2,
  
  
  
  1.17      +6 -11     xml-xalan/c/src/XSLT/ElemTextLiteral.cpp
  
  Index: ElemTextLiteral.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElemTextLiteral.cpp       14 May 2002 15:46:30 -0000      1.16
  +++ ElemTextLiteral.cpp       21 Sep 2002 01:24:41 -0000      1.17
  @@ -67,6 +67,7 @@
   
   
   #include "Constants.hpp"
  +#include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
   
   
  @@ -91,7 +92,9 @@
        m_preserveSpace(preserveSpace), 
        m_disableOutputEscaping(disableOutputEscaping),
        m_isWhitespace(isXMLWhitespace(ch, start, length)),
  -     m_ch(ch + start, length)
  +     // Always null-terminate our buffer, since we may need it that way.
  +     m_ch(constructionContext.allocateVector(ch + start, length, true)),
  +     m_length(length)
   {
   }
   
  @@ -104,14 +107,6 @@
   
   
   const XalanDOMString&
  -ElemTextLiteral::getNodeValue() const
  -{
  -     return m_ch;
  -}
  -
  -
  -
  -const XalanDOMString&
   ElemTextLiteral::getElementName() const
   {
        return Constants::ELEMNAME_TEXT_WITH_PREFIX_STRING;
  @@ -134,10 +129,10 @@
   
       if(!m_disableOutputEscaping)
       {
  -             executionContext.characters(toCharArray(m_ch), 0, length(m_ch));
  +             executionContext.characters(m_ch, 0, m_length);
       }
       else
       {
  -             executionContext.charactersRaw(toCharArray(m_ch), 0, 
length(m_ch));
  +             executionContext.charactersRaw(m_ch, 0, m_length);
       }
   }
  
  
  
  1.15      +9 -5      xml-xalan/c/src/XSLT/ElemTextLiteral.hpp
  
  Index: ElemTextLiteral.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemTextLiteral.hpp       14 May 2002 15:46:30 -0000      1.14
  +++ ElemTextLiteral.hpp       21 Sep 2002 01:24:41 -0000      1.15
  @@ -116,21 +116,24 @@
                return m_preserveSpace;
        }
   
  -     const XalanDOMString&
  +     const XalanDOMChar*
        getText() const
        {
                return m_ch;
        }
   
  +     const XalanDOMString::size_type
  +     getLength() const
  +     {
  +             return m_length;
  +     }
  +
        virtual bool
        isWhitespace() const;
   
        // These methods are inherited from ElemTemplateElement ...
        
        virtual const XalanDOMString&
  -     getNodeValue() const;
  -
  -     virtual const XalanDOMString&
        getElementName() const;
   
        virtual void
  @@ -149,7 +152,8 @@
        const bool                              m_disableOutputEscaping;
        const bool                              m_isWhitespace;
   
  -     const XalanDOMString    m_ch;
  +     const XalanDOMChar* const                       m_ch;
  +     const XalanDOMString::size_type         m_length;
   };
   
   
  
  
  
  1.23      +69 -45    xml-xalan/c/src/XSLT/FunctionKey.cpp
  
  Index: FunctionKey.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionKey.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FunctionKey.cpp   26 Sep 2001 21:30:23 -0000      1.22
  +++ FunctionKey.cpp   21 Sep 2002 01:24:41 -0000      1.23
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -78,6 +78,7 @@
   
   #include <XPath/MutableNodeRefList.hpp>
   #include <XPath/NodeRefListBase.hpp>
  +#include <XPath/XalanQNameByReference.hpp>
   #include <XPath/XObjectFactory.hpp>
   
   
  @@ -101,10 +102,44 @@
   
   
   
  +inline void
  +getNodeSet(
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDocument*                  document,
  +                     const XalanDOMString&   keyname,
  +                     const XalanDOMString&   ref,
  +                     const Locator*                  locator,
  +                     MutableNodeRefList&             theNodeRefList)
  +{
  +     assert(document != 0);
  +
  +     if (indexOf(keyname, XalanUnicode::charColon) < length(keyname))
  +     {
  +             executionContext.getNodeSetByKey(
  +                             document,
  +                             keyname,
  +                             ref,
  +                             locator,
  +                             theNodeRefList);
  +     }
  +     else
  +     {
  +             const XalanQNameByReference             theQName(keyname);
  +
  +             executionContext.getNodeSetByKey(
  +                             document,
  +                             theQName,
  +                             ref,
  +                             theNodeRefList);
  +     }
  +}
  +
  +
  +
   XObjectPtr
   FunctionKey::execute(
                        XPathExecutionContext&  executionContext,
  -                     XalanNode*                              context,        
                
  +                     XalanNode*                              context,
                        const XObjectPtr                arg1,
                        const XObjectPtr                arg2,
                        const Locator*                  locator) const
  @@ -131,45 +166,49 @@
   #endif
                                                        
context->getOwnerDocument();
   
  -             if(0 == docContext)
  -             {
  -                     executionContext.error(
  -                             "Context does not have an owner document!",
  -                             context,
  -                             locator);
  -             }
  -
  +             assert(docContext != 0);
                assert(executionContext.getPrefixResolver() != 0);
   
                const XalanDOMString&   keyname = arg1->str();
   
                assert(arg2.null() == false);
   
  -             const bool                              argIsNodeSet =
  -                             XObject::eTypeNodeSet == arg2->getType() ? true 
: false;
  -
                typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
   
                // This list will hold the nodes...
                BorrowReturnMutableNodeRefList  
theNodeRefList(executionContext);
   
  -             if(argIsNodeSet == true)
  +             if(arg2->getType() != XObject::eTypeNodeSet)
  +             {
  +                     getNodeSet(
  +                             executionContext,
  +                             docContext,
  +                             keyname,
  +                             arg2->str(),
  +                             locator,
  +                             *theNodeRefList.get());
  +             }
  +             else
                {
                        const NodeRefListBase&  theNodeSet = arg2->nodeset();
   
                        const NodeRefListBase::size_type        nRefs = 
theNodeSet.getLength();
   
  -                     if (nRefs > 0)
  +                     if (nRefs == 1)
                        {
  -#if defined(XALAN_NO_NAMESPACES)
  -                             typedef set<XalanDOMString, 
less<XalanDOMString> >      StringSetType;
  -#else
  -                             typedef std::set<XalanDOMString>        
StringSetType;
  -#endif
  -
  -                             StringSetType   usedrefs;
  +                             getNodeSet(
  +                                     executionContext,
  +                                     docContext,
  +                                     keyname,
  +                                     arg2->str(),
  +                                     locator,
  +                                     *theNodeRefList.get());
  +                     }
  +                     else if (nRefs > 1)
  +                     {
  +                             
XPathExecutionContext::GetAndReleaseCachedString        
theResult(executionContext);
   
  -                             XalanDOMString  ref;
  +                             XalanDOMString&         ref = theResult.get();
   
                                for(NodeRefListBase::size_type i = 0; i < 
nRefs; i++)
                                {
  @@ -179,33 +218,18 @@
   
                                        if(0 != length(ref))
                                        {
  -                                             // Make sure we haven't already 
processed it...
  -                                             if(usedrefs.find(ref) == 
usedrefs.end())
  -                                             {
  -                                                     usedrefs.insert(ref);
  -
  -                                                     
executionContext.getNodeSetByKey(
  -                                                                             
        docContext, 
  -                                                                             
        keyname,
  -                                                                             
        ref,
  -                                                                             
        *executionContext.getPrefixResolver(),
  -                                                                             
        *theNodeRefList.get());
  -                                             }
  +                                             getNodeSet(
  +                                                     executionContext,
  +                                                     docContext,
  +                                                     keyname,
  +                                                     ref,
  +                                                     locator,
  +                                                     *theNodeRefList.get());
                                        }
   
                                        clear(ref);
                                }
                        }
  -             }
  -             else
  -             {
  -                     const XalanDOMString&   ref = arg2->str();
  -
  -                                     
executionContext.getNodeSetByKey(docContext,
  -                                                                             
        keyname,
  -                                                                             
        ref,
  -                                                                             
        *executionContext.getPrefixResolver(),
  -                                                                             
        *theNodeRefList.get());
                }
   
                return 
executionContext.getXObjectFactory().createNodeSet(theNodeRefList);
  
  
  
  1.19      +0 -2      xml-xalan/c/src/XSLT/KeyTable.cpp
  
  Index: KeyTable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- KeyTable.cpp      19 Dec 2001 22:06:51 -0000      1.18
  +++ KeyTable.cpp      21 Sep 2002 01:24:41 -0000      1.19
  @@ -89,12 +89,10 @@
   
   
   KeyTable::KeyTable(
  -                     XalanNode*                                              
        doc,
                        XalanNode*                                              
        startNode,
                        const PrefixResolver&                           
resolver,
                        const KeyDeclarationVectorType&         keyDeclarations,
                        StylesheetExecutionContext&                     
executionContext) :
  -     m_docKey(doc),
        m_keys()
   {
       XalanNode*       pos = startNode;
  
  
  
  1.13      +3 -18     xml-xalan/c/src/XSLT/KeyTable.hpp
  
  Index: KeyTable.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- KeyTable.hpp      20 Dec 2001 00:24:53 -0000      1.12
  +++ KeyTable.hpp      21 Sep 2002 01:24:41 -0000      1.13
  @@ -62,7 +62,6 @@
    * 
    * $State$
    * 
  - * @author Myriam Midy (Myriam_Midy @lotus.com 
    */
   
   
  @@ -91,6 +90,7 @@
   class PrefixResolver;
   class StylesheetExecutionContext;
   class XalanElement;
  +class XalanDocument;
   class XalanNode;
   
   
  @@ -130,8 +130,6 @@
        /**
         * Build a keys table.
         *
  -      * @param doc              owner document key (normally the same as
  -      *                         startNode)
         * @param startNode        node to start iterating from to build the 
keys
         *                         index
         * @param nscontext        stylesheet's namespace context
  @@ -139,7 +137,6 @@
         * @param executionContext current execution context
         */
        KeyTable(
  -                     XalanNode*                                              
        doc,
                        XalanNode*                                              
        startNode,
                        const PrefixResolver&                           
resolver,
                        const KeyDeclarationVectorType&         keyDeclarations,
  @@ -165,18 +162,6 @@
                                  const XalanQName&                     qname,
                                  const XalanDOMString&         ref) const;
   
  -     /**
  -      * Retrieve the document key.  This table should only be used with 
contexts
  -      * whose Document root matches this key.
  -      * 
  -      * @return Node for document
  -      */
  -     const XalanNode*
  -     getDocKey() const
  -     {
  -             return m_docKey;
  -     }
  -
   private:
   
        /**
  @@ -202,7 +187,7 @@
         * The document key.  This table should only be used with contexts
         * whose Document roots match this key.
         */
  -     const XalanNode*        m_docKey;
  +     const XalanDocument*    m_docKey;
   
        /**
         * Table of element keys.  The table will be built on demand, 
  
  
  
  1.8       +12 -22    xml-xalan/c/src/XSLT/ResultNamespacesStack.cpp
  
  Index: ResultNamespacesStack.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ResultNamespacesStack.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResultNamespacesStack.cpp 16 May 2002 00:47:55 -0000      1.7
  +++ ResultNamespacesStack.cpp 21 Sep 2002 01:24:41 -0000      1.8
  @@ -76,9 +76,11 @@
   
   void
   ResultNamespacesStack::addDeclaration(
  -                     const XalanDOMString&   thePrefix,
  -                     const XalanDOMString&   theNamespaceURI)
  +                     const XalanDOMString&           thePrefix,
  +             const XalanDOMChar*                     theNamespaceURI,
  +                     XalanDOMString::size_type       theLength)
   {
  +     assert(theNamespaceURI != 0);
        assert(m_createNewContextStack.size() != 0);
   
        // Check to see if we need to create a new context and do so if 
necessary...
  @@ -91,8 +93,14 @@
   
        NamespaceVectorType&    theCurrentNamespaces = 
m_resultNamespaces.back();
   
  -     // Add the namespace at the end of the current namespaces.
  -     theCurrentNamespaces.push_back(NameSpace(thePrefix, theNamespaceURI));
  +     // Add a new namespace at the end of the current namespaces.
  +     theCurrentNamespaces.resize(theCurrentNamespaces.size() + 1);
  +
  +     NameSpace&      theNewNamespace = theCurrentNamespaces.back();
  +
  +     theNewNamespace.setPrefix(thePrefix);
  +
  +     theNewNamespace.setURI(theNamespaceURI, theLength);
   }
   
   
  @@ -123,24 +131,6 @@
        }
   
        m_createNewContextStack.pop_back();
  -}
  -
  -
  -
  -const XalanDOMString*
  -ResultNamespacesStack::getNamespaceForPrefix(const XalanDOMString&   
thePrefix) const
  -{
  -     // Search vector from first element back
  -     return XalanQName::getNamespaceForPrefix(m_resultNamespaces, thePrefix, 
true);
  -}
  -
  -
  -
  -const XalanDOMString*
  -ResultNamespacesStack::getPrefixForNamespace(const XalanDOMString&   
theNamespaceURI) const
  -{
  -     // Search vector from first element back
  -     return XalanQName::getPrefixForNamespace(m_resultNamespaces, 
theNamespaceURI, true);
   }
   
   
  
  
  
  1.7       +34 -3     xml-xalan/c/src/XSLT/ResultNamespacesStack.hpp
  
  Index: ResultNamespacesStack.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ResultNamespacesStack.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ResultNamespacesStack.hpp 24 Jul 2002 23:18:02 -0000      1.6
  +++ ResultNamespacesStack.hpp 21 Sep 2002 01:24:41 -0000      1.7
  @@ -100,7 +100,30 @@
        void
        addDeclaration(
                        const XalanDOMString&   thePrefix,
  -             const XalanDOMString&   theNamespaceURI);
  +             const XalanDOMString&   theNamespaceURI)
  +     {
  +             addDeclaration(
  +                     thePrefix,
  +                     theNamespaceURI.c_str(),
  +                     theNamespaceURI.length());
  +     }
  +
  +     void
  +     addDeclaration(
  +                     const XalanDOMString&   thePrefix,
  +             const XalanDOMChar*             theNamespaceURI)
  +     {
  +             addDeclaration(
  +                     thePrefix,
  +                     theNamespaceURI,
  +                     length(theNamespaceURI));
  +     }
  +
  +     void
  +     addDeclaration(
  +                     const XalanDOMString&           thePrefix,
  +             const XalanDOMChar*                     theNamespaceURI,
  +                     XalanDOMString::size_type       theLength);
   
        void
        pushContext();
  @@ -109,10 +132,18 @@
        popContext();
   
        const XalanDOMString*
  -     getNamespaceForPrefix(const XalanDOMString&             thePrefix) 
const;
  +     getNamespaceForPrefix(const XalanDOMString&             thePrefix) const
  +     {
  +             // Search vector from first element back
  +             return XalanQName::getNamespaceForPrefix(m_resultNamespaces, 
thePrefix, true);
  +     }
   
        const XalanDOMString*
  -     getPrefixForNamespace(const XalanDOMString&             
theNamespaceURI) const;
  +     getPrefixForNamespace(const XalanDOMString&             
theNamespaceURI) const
  +     {
  +             // Search vector from first element back
  +             return XalanQName::getPrefixForNamespace(m_resultNamespaces, 
theNamespaceURI, true);
  +     }
   
   
        /**
  
  
  
  1.14      +49 -0     xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetConstructionContext.hpp 6 Sep 2002 01:39:18 -0000       1.13
  +++ StylesheetConstructionContext.hpp 21 Sep 2002 01:24:41 -0000      1.14
  @@ -338,6 +338,55 @@
        virtual double
        getXSLTVersionSupported() const = 0;
   
  +     /**
  +      * Get a pooled string given the source string.  If
  +      * the string already exists in the pool, no copy
  +      * will be made.  If not, a copy will be made and
  +      * kept for later use.
  +      *
  +      * @param theString The source string
  +      * @return a const reference to a pooled string.
  +      */
  +     virtual const XalanDOMString&
  +     getPooledString(const XalanDOMString&   theString) = 0;
  +
  +     /**
  +      * Get a pooled string given the source character
  +      * array.  If the string already exists in the pool,
  +      * no copy will be made.  If not, a copy will be made
  +      * and kept for later use.
  +      *
  +      * @param theString The source character array
  +      * @param theLength The length of the character array
  +      * @return a const reference to a pooled string.
  +      */
  +     virtual const XalanDOMString&
  +     getPooledString(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength = 
XalanDOMString::npos) = 0;
  +
  +     /**
  +      * Allocate a vector of XalanDOMChar of the specified
  +      * size.
  +      *
  +      * @param theLength The length of the character vector
  +      */
  +     virtual XalanDOMChar*
  +     allocateVector(XalanDOMString::size_type                theLength) = 0;
  +
  +     /**
  +      * Allocate a vector of XalanDOMChar of the specified
  +      * size.
  +      *
  +      * @param theString The source character array
  +      * @param theLength The length of the character vector
  +      * @param fTerminate If true, terminate the new vector with 0
  +      */
  +     virtual XalanDOMChar*
  +     allocateVector(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength = 
XalanDOMString::npos,
  +                     bool                                            
fTerminate = true) = 0;
   
        // These interfaces are inherited from ExecutionContext...
   
  
  
  
  1.20      +62 -17    
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- StylesheetConstructionContextDefault.cpp  6 Sep 2002 01:39:18 -0000       
1.19
  +++ StylesheetConstructionContextDefault.cpp  21 Sep 2002 01:24:41 -0000      
1.20
  @@ -88,28 +88,16 @@
   
   
   StylesheetConstructionContextDefault::StylesheetConstructionContextDefault(
  -                     XSLTEngineImpl&         processor,
  -                     XPathEnvSupport&        /* xpathEnvSupport */,
  -                     XPathFactory&           xpathFactory) :
  -     StylesheetConstructionContext(),
  -     m_processor(processor),
  -     m_xpathFactory(xpathFactory),
  -     m_xpathProcessor(new XPathProcessorImpl),
  -     m_stylesheets(),
  -     m_tempBuffer()
  -{
  -}
  -
  -
  -
  -StylesheetConstructionContextDefault::StylesheetConstructionContextDefault(
  -                     XSLTEngineImpl&         processor,
  -                     XPathFactory&           xpathFactory) :
  +                     XSLTEngineImpl&                         processor,
  +                     XPathFactory&                           xpathFactory,
  +                     VectorAllocatorSizeType         theAllocatorSize) :
        StylesheetConstructionContext(),
        m_processor(processor),
        m_xpathFactory(xpathFactory),
        m_xpathProcessor(new XPathProcessorImpl),
        m_stylesheets(),
  +     m_stringPool(),
  +     m_xalanDOMCharVectorAllocator(theAllocatorSize),
        m_tempBuffer()
   {
   }
  @@ -539,4 +527,61 @@
   StylesheetConstructionContextDefault::getXSLTVersionSupported() const
   {
        return XSLTEngineImpl::getXSLTVerSupported();
  +}
  +
  +
  +
  +const XalanDOMString&
  +StylesheetConstructionContextDefault::getPooledString(const XalanDOMString&  
        theString)
  +{
  +     return m_stringPool.get(theString);
  +}
  +
  +
  +
  +const XalanDOMString&
  +StylesheetConstructionContextDefault::getPooledString(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength)
  +{
  +     return m_stringPool.get(theString, theLength);
  +}
  +
  +
  +
  +XalanDOMChar*
  
+StylesheetConstructionContextDefault::allocateVector(XalanDOMString::size_type 
      theLength)
  +{
  +     return m_xalanDOMCharVectorAllocator.allocate(theLength);
  +}
  +
  +
  +
  +XalanDOMChar*
  +StylesheetConstructionContextDefault::allocateVector(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength,
  +                     bool                                            
fTerminate)
  +{
  +     assert(theString != 0);
  +
  +     const XalanDOMString::size_type         theActualLength =
  +             theLength == XalanDOMString::npos ? 
XalanDOMString::length(theString) : theLength;
  +
  +     XalanDOMChar* const             theVector =
  +             m_xalanDOMCharVectorAllocator.allocate(fTerminate == true ? 
theActualLength + 1 : theActualLength);
  +
  +#if !defined(XALAN_NO_NAMESPACES)
  +     using std::copy;
  +#endif
  +
  +     XalanDOMChar* const             theEnd =
  +             std::copy(theString, theString + theActualLength, theVector);
  +
  +     if (fTerminate == true)
  +     {
  +             *theEnd = XalanDOMChar(0);
  +     }
  +
  +     return theVector;
   }
  
  
  
  1.22      +35 -21    
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StylesheetConstructionContextDefault.hpp  6 Sep 2002 01:39:18 -0000       
1.21
  +++ StylesheetConstructionContextDefault.hpp  21 Sep 2002 01:24:41 -0000      
1.22
  @@ -66,6 +66,11 @@
   
   
   
  +#include <PlatformSupport/XalanArrayAllocator.hpp>
  +#include <PlatformSupport/XalanDOMStringPool.hpp>
  +
  +
  +
   #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) || (XALAN_ALLINONE_BUILD_DLL)
   #include <XPath/XPathProcessor.hpp>
   #endif
  @@ -103,24 +108,11 @@
   {
   public:
   
  -     /*
  -      * Construct an instance.  If the stylesheet(s) constructed is/are 
meant to be reused (a.k.a. "compiled"),
  -      * the XObjectFactory and XPathFactory instance must exist for the 
lifetime of the construction context
  -      * and, therefore, for the lifetime of the stylesheet(s).  Otherwise, 
XObject and XPath instance will be
  -      * destroyed when the corresponding factories are destryed, leaving 
pointers to destroyed objects in the.
  -      * stylesheet(s).
  -      *
  -      * @deprecated This constructor is deprecated.
  -      *
  -      * @param processor a reference to an XSLTEngineImpl instance.  Used 
for error reporting.
  -      * @param xpathEnvSupport a reference to an XPathEnvSupport instance.
  -      * @param xpathFactory a reference to an XPathFactory instance.  See 
comments above for important details.
  -      *
  -      */
  -     StylesheetConstructionContextDefault(
  -                     XSLTEngineImpl&         processor,
  -                     XPathEnvSupport&        xpathEnvSupport,
  -                     XPathFactory&           xpathFactory);
  +     typedef XalanArrayAllocator<XalanDOMChar>                       
XalanDOMCharVectorAllocatorType;
  +     typedef XalanDOMCharVectorAllocatorType::size_type      
VectorAllocatorSizeType;
  +
  +    // Default size for vector allocation.
  +     enum { eDefaultBlockSize = 1024 };
   
        /*
         * Construct an instance.  If the stylesheet(s) constructed is/are 
meant to be reused (a.k.a. "compiled"),
  @@ -131,11 +123,12 @@
         *
         * @param processor a reference to an XSLTEngineImpl instance.  Used 
for error reporting.
         * @param xpathFactory a reference to an XPathFactory instance.  See 
comments above for important details.
  -      *
  +      * @param theAllocatorSize The block size to use for allocating vectors 
of XalanDOMChars
         */
        StylesheetConstructionContextDefault(
  -                     XSLTEngineImpl&         processor,
  -                     XPathFactory&           xpathFactory);
  +                     XSLTEngineImpl&                         processor,
  +                     XPathFactory&                           xpathFactory,
  +                     VectorAllocatorSizeType         theAllocatorSize = 
eDefaultBlockSize);
   
        virtual
        ~StylesheetConstructionContextDefault();
  @@ -300,6 +293,23 @@
        virtual double
        getXSLTVersionSupported() const;
   
  +     virtual const XalanDOMString&
  +     getPooledString(const XalanDOMString&   theString);
  +
  +     virtual const XalanDOMString&
  +     getPooledString(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength = 
XalanDOMString::npos);
  +
  +     virtual XalanDOMChar*
  +     allocateVector(XalanDOMString::size_type                theLength);
  +
  +     virtual XalanDOMChar*
  +     allocateVector(
  +                     const XalanDOMChar*                     theString,
  +                     XalanDOMString::size_type       theLength = 
XalanDOMString::npos,
  +                     bool                                            
fTerminate = true);
  +
   #if defined(XALAN_NO_NAMESPACES)
        typedef set<StylesheetRoot*,
                                less<StylesheetRoot*> >         
StylesheetSetType;
  @@ -318,6 +328,10 @@
        XPathProcessAutoPtr                                     
m_xpathProcessor;
   
        StylesheetSetType                                       m_stylesheets;
  +
  +     XalanDOMStringPool                                      m_stringPool;
  +
  +     XalanDOMCharVectorAllocatorType         m_xalanDOMCharVectorAllocator;
   
        mutable XalanDOMString                          m_tempBuffer;
   };
  
  
  
  1.78      +20 -6     xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- StylesheetExecutionContext.hpp    13 Aug 2002 05:56:04 -0000      1.77
  +++ StylesheetExecutionContext.hpp    21 Sep 2002 01:24:41 -0000      1.78
  @@ -447,6 +447,17 @@
                        const XalanDOMString&   value) = 0;
   
        /**
  +      * Add a result attribute to the list of pending attributes.
  +      * 
  +      * @param aname name of attribute
  +      * @param value value of attribute
  +      */
  +     virtual void
  +     addResultAttribute(
  +                     const XalanDOMString&   aname,
  +                     const XalanDOMChar*             value) = 0;
  +
  +     /**
         * Add namespace attributes for a node to the list of pending 
attributes.
         * 
         * @param src                 source node
  @@ -628,7 +639,6 @@
         * Execute the supplied XPath and and create a
         * variable in the current context.
         *
  -      * @param element         element marker for variable
         * @param str         string expression for XPath evaluation
         * @param contextNode current node in the source tree
         * @param resolver    resolver for namespace resolution
  @@ -636,7 +646,6 @@
         */
        virtual const XObjectPtr
        createVariable(
  -                     const ElemTemplateElement*      element,
                        const XPath&                            xpath,
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver) = 0;
  @@ -645,14 +654,12 @@
         * Create an ResultTreeFragment as a variable and push it
         * on to the stack with the current context.
         *
  -      * @param element element marker for variable
         * @param templateChild result tree fragment to use.
         * @param sourceNode source node
         * @return a pointer to the XObject result
         */
        virtual const XObjectPtr
        createVariable(
  -                     const ElemTemplateElement*      element,
                        const ElemTemplateElement&      templateChild,
                        XalanNode*                                      
sourceNode) = 0;
   
  @@ -1814,10 +1821,17 @@
   
        virtual void
        getNodeSetByKey(
  -                     XalanNode*                              doc,
  +                     XalanDocument*                  doc,
  +                     const XalanQName&               qname,
  +                     const XalanDOMString&   ref,
  +                     MutableNodeRefList&             nodelist) = 0;
  +
  +     virtual void
  +     getNodeSetByKey(
  +                     XalanDocument*                  doc,
                        const XalanDOMString&   name,
                        const XalanDOMString&   ref,
  -                     const PrefixResolver&   resolver,
  +                     const Locator*                  locator,
                        MutableNodeRefList&             nodelist) = 0;
   
        virtual const XObjectPtr
  
  
  
  1.99      +55 -14    
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- StylesheetExecutionContextDefault.cpp     12 Sep 2002 21:31:47 -0000      
1.98
  +++ StylesheetExecutionContextDefault.cpp     21 Sep 2002 01:24:41 -0000      
1.99
  @@ -79,7 +79,6 @@
   
   
   
  -#include <XPath/XalanQNameByReference.hpp>
   #include <XPath/ResultTreeFragBase.hpp>
   #include <XPath/XObjectFactory.hpp>
   #include <XPath/XPath.hpp>
  @@ -170,7 +169,8 @@
        m_usePerInstanceDocumentFactory(true),
        m_cloneTextNodesOnly(false),
        m_escapeURLs(eEscapeURLsDefault),
  -     m_omitMETATag(eOmitMETATagDefault)
  +     m_omitMETATag(eOmitMETATagDefault),
  +     m_scratchQName()
   {
   }
   
  @@ -212,7 +212,8 @@
        m_documentAllocator(eDocumentAllocatorBlockSize),
        m_usePerInstanceDocumentFactory(true),
        m_cloneTextNodesOnly(false),
  -     m_escapeURLs(eEscapeURLsDefault)
  +     m_escapeURLs(eEscapeURLsDefault),
  +     m_scratchQName()
   {
   }
   
  @@ -431,6 +432,18 @@
   
   
   void
  +StylesheetExecutionContextDefault::addResultAttribute(
  +                     const XalanDOMString&   aname,
  +                     const XalanDOMChar*             value)
  +{
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->addResultAttribute(aname, value);
  +}
  +
  +
  +
  +void
   StylesheetExecutionContextDefault::copyNamespaceAttributes(const XalanNode&  
        src)
   {
        assert(m_xsltProcessor != 0);
  @@ -629,7 +642,6 @@
   
   const XObjectPtr
   StylesheetExecutionContextDefault::createVariable(
  -                     const ElemTemplateElement*      /* element */,
                        const XPath&                            xpath,
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver)
  @@ -641,7 +653,6 @@
   
   const XObjectPtr
   StylesheetExecutionContextDefault::createVariable(
  -                     const ElemTemplateElement*      /* element */,
                        const ElemTemplateElement&      templateChild,
                        XalanNode*                                      
sourceNode)
   {
  @@ -807,11 +818,9 @@
   const XObjectPtr
   StylesheetExecutionContextDefault::getParamVariable(const XalanQName&        
theName)
   {
  -     bool                            fFound;
  -
  -     const XObjectPtr        
theValue(m_variablesStack.getParamVariable(theName, *this, fFound));
  +     bool    fFound;
   
  -     return theValue;
  +     return m_variablesStack.getParamVariable(theName, *this, fFound);
   }
   
   
  @@ -1837,15 +1846,49 @@
   
   void
   StylesheetExecutionContextDefault::getNodeSetByKey(
  -                     XalanNode*                              doc,
  +                     XalanDocument*                  doc,
  +                     const XalanQName&               qname,
  +                     const XalanDOMString&   ref,
  +                     MutableNodeRefList&             nodelist)
  +{
  +     assert(m_stylesheetRoot != 0);
  +
  +     m_stylesheetRoot->getNodeSetByKey(
  +             doc,
  +             qname,
  +             ref,
  +             *getPrefixResolver(),
  +             nodelist,
  +             *this,
  +             m_keyTables);
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::getNodeSetByKey(
  +                     XalanDocument*                  doc,
                        const XalanDOMString&   name,
                        const XalanDOMString&   ref,
  -                     const PrefixResolver&   resolver,
  +                     const Locator*                  locator,
                        MutableNodeRefList&             nodelist)
   {
        assert(m_stylesheetRoot != 0);
   
  -     m_stylesheetRoot->getNodeSetByKey(doc, name, ref, resolver, nodelist, 
*this, m_keyTables);
  +     const PrefixResolver* const             resolver =
  +                             getPrefixResolver();
  +     assert(resolver != 0);
  +
  +     m_scratchQName.set(name, resolver, locator);
  +
  +     m_stylesheetRoot->getNodeSetByKey(
  +             doc,
  +             m_scratchQName,
  +             ref,
  +             *resolver,
  +             nodelist,
  +             *this,
  +             m_keyTables);
   }
   
   
  @@ -2342,7 +2385,6 @@
                                {
                                        theXObject =
                                                createVariable(
  -                                                     &xslCallTemplateElement,
                                                        *pxpath,
                                                        sourceNode,
                                                        *xslParamElement);
  @@ -2351,7 +2393,6 @@
                                {
                                        theXObject =
                                                createVariable(
  -                                                     &xslCallTemplateElement,
                                                        *xslParamElement,
                                                        sourceNode);
                                }
  
  
  
  1.83      +16 -4     
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- StylesheetExecutionContextDefault.hpp     13 Aug 2002 05:37:06 -0000      
1.82
  +++ StylesheetExecutionContextDefault.hpp     21 Sep 2002 01:24:41 -0000      
1.83
  @@ -348,6 +348,11 @@
                        const XalanDOMString&   value);
   
        virtual void
  +     addResultAttribute(
  +                     const XalanDOMString&   aname,
  +                     const XalanDOMChar*             value);
  +
  +     virtual void
        copyNamespaceAttributes(const XalanNode&        src);
   
        virtual const XalanDOMString*
  @@ -397,14 +402,12 @@
   
        virtual const XObjectPtr
        createVariable(
  -                     const ElemTemplateElement*      element,
                        const XPath&                            xpath,
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver);
   
        virtual const XObjectPtr
        createVariable(
  -                     const ElemTemplateElement*      element,
                        const ElemTemplateElement&      templateChild,
                        XalanNode*                                      
sourceNode);
   
  @@ -877,11 +880,18 @@
        releaseCachedString(XalanDOMString&             theString);
   
        virtual void
  +     getNodeSetByKey(
  +                     XalanDocument*                  doc,
  +                     const XalanQName&               qname,
  +                     const XalanDOMString&   ref,
  +                     MutableNodeRefList&             nodelist);
  +
  +     virtual void
        getNodeSetByKey(                        
  -                     XalanNode*                              doc,
  +                     XalanDocument*                  doc,
                        const XalanDOMString&   name,
                        const XalanDOMString&   ref,
  -                     const PrefixResolver&   resolver,
  +                     const Locator*                  locator,
                        MutableNodeRefList&             nodelist);
   
        virtual const XObjectPtr
  @@ -1171,6 +1181,8 @@
   
        // Determines whether or not to override the property in the stylesheet.
        eOmitMETATag                                            m_omitMETATag;
  +
  +     XalanQNameByValue                                       m_scratchQName;
   
        static XalanNumberFormatFactory         
s_defaultXalanNumberFormatFactory;
   
  
  
  
  1.86      +13 -12    xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- StylesheetHandler.cpp     5 Sep 2002 01:38:21 -0000       1.85
  +++ StylesheetHandler.cpp     21 Sep 2002 01:24:41 -0000      1.86
  @@ -144,6 +144,7 @@
        m_inTemplate(false),
        m_foundStylesheet(false),
        m_foundNotImport(false),
  +     m_elementLocalName(),
        m_accumulateText(),
        m_includeBase(stylesheetTree.getBaseIdentifier()),
        m_inExtensionElementStack(),
  @@ -261,11 +262,9 @@
                        const Locator*                  locator,
                        bool&                                   fPreserve)
   {
  -     const XalanDOMString            theAttributeName(aname);
  +     m_spaceAttributeQName.set(aname, m_stylesheet.getNamespaces(), locator, 
true);
   
  -     const XalanQNameByValue         theName(theAttributeName, 
m_stylesheet.getNamespaces());
  -
  -     const bool                                      isSpaceAttr = 
s_spaceAttrQName.equals(theName);
  +     const bool      isSpaceAttr = 
s_spaceAttrQName.equals(m_spaceAttributeQName);
   
        if(isSpaceAttr == false)
        {
  @@ -384,11 +383,13 @@
                        error("Could not resolve prefix.", locator);
                }
   
  -             XalanDOMString  localName(name, nameLength);
  -
                if (index < nameLength)
                {
  -                     localName.erase(0, index + 1);
  +                     m_elementLocalName.assign(name + index + 1, nameLength 
- index - 1);
  +             }
  +             else
  +             {
  +                     m_elementLocalName.assign(name, nameLength);
                }
   
                ElemTemplateElement* elem = 0;
  @@ -406,11 +407,11 @@
                                m_stylesheet.setWrapperless(false);
                        }
   
  -                     const int       xslToken = 
m_constructionContext.getElementToken(localName);
  +                     const int       xslToken = 
m_constructionContext.getElementToken(m_elementLocalName);
   
                        if(!m_inTemplate)
                        {
  -                             processTopLevelElement(name, localName, ns, 
atts, xslToken, locator, fPreserveSpace, fSpaceAttrProcessed);
  +                             processTopLevelElement(name, 
m_elementLocalName, ns, atts, xslToken, locator, fPreserveSpace, 
fSpaceAttrProcessed);
                        }
                        else
                        {
  @@ -693,7 +694,7 @@
   
                                default:
                                        {
  -                                             const XalanDOMString    
msg("Unknown XSL element: " + localName);
  +                                             const XalanDOMString    
msg("Unknown XSL element: " + m_elementLocalName);
   
                                                // If this stylesheet is 
declared to be of a higher version than the one
                                                // supported, don't flag an 
error.
  @@ -713,7 +714,7 @@
                }
                else if (!m_inTemplate && startsWith(ns, 
m_constructionContext.getXalanXSLNameSpaceURL()))
                {
  -                     processExtensionElement(name, localName, atts, locator);
  +                     processExtensionElement(name, m_elementLocalName, atts, 
locator);
                }
                else
                {
  @@ -751,7 +752,7 @@
                                                                                
        lineNumber,
                                                                                
        columnNumber,
                                                                                
        *nsh,
  -                                                                             
        localName);
  +                                                                             
        m_elementLocalName);
   
                                        
assert(m_inExtensionElementStack.empty() == false);
   
  
  
  
  1.34      +4 -0      xml-xalan/c/src/XSLT/StylesheetHandler.hpp
  
  Index: StylesheetHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StylesheetHandler.hpp     5 Aug 2002 04:57:50 -0000       1.33
  +++ StylesheetHandler.hpp     21 Sep 2002 01:24:41 -0000      1.34
  @@ -595,6 +595,10 @@
         */
        bool m_foundNotImport;
   
  +     XalanDOMString          m_elementLocalName;
  +
  +     XalanQNameByValue       m_spaceAttributeQName;
  +
        /**
         * Accumulate character buffer to create contiguous character data
         * where possible.
  
  
  
  1.62      +5 -8      xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- StylesheetRoot.cpp        5 Sep 2002 22:01:16 -0000       1.61
  +++ StylesheetRoot.cpp        21 Sep 2002 01:24:41 -0000      1.62
  @@ -721,8 +721,8 @@
   
   void
   StylesheetRoot::getNodeSetByKey(
  -                     XalanNode*                                              
doc,
  -                     const XalanDOMString&                   name,
  +                     XalanDocument*                                  doc,
  +                     const XalanQName&                               qname,
                        const XalanDOMString&                   ref,
                        const PrefixResolver&                   resolver,
                        MutableNodeRefList&                             
nodelist,
  @@ -736,27 +736,24 @@
                const KeyTablesTableType::const_iterator        i =
                        theKeysTable.find(doc);
   
  -             const XalanQNameByValue         theQName(name, &resolver);
  -
                if (i != theKeysTable.end())
                {
  -                     const NodeRefListBase&  nl = 
(*i).second->getNodeSetByKey(theQName, ref);
  +                     const NodeRefListBase&  nl = 
(*i).second->getNodeSetByKey(qname, ref);
   
                        nodelist.addNodesInDocOrder(nl, executionContext);
                }
                else
                {
                        KeyTable* const kt =
  -                             new KeyTable(doc,
  +                             new KeyTable(
                                                         doc,
                                                         resolver,
                                                         m_keyDeclarations,
                                                         executionContext);
  -                     assert(doc == kt->getDocKey());
   
                        theKeysTable[doc] = kt;
   
  -                     const NodeRefListBase&  nl = 
kt->getNodeSetByKey(theQName, ref);
  +                     const NodeRefListBase&  nl = kt->getNodeSetByKey(qname, 
ref);
   
                        nodelist.addNodesInDocOrder(nl, executionContext);
                }
  
  
  
  1.20      +3 -3      xml-xalan/c/src/XSLT/StylesheetRoot.hpp
  
  Index: StylesheetRoot.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- StylesheetRoot.hpp        13 Aug 2002 05:37:07 -0000      1.19
  +++ StylesheetRoot.hpp        21 Sep 2002 01:24:41 -0000      1.20
  @@ -425,7 +425,7 @@
         * Given a valid element key, return the corresponding node list.
         *
         * @param doc                      source document
  -      * @param name                     name of the key, which must match 
the 'name'
  +      * @param name                     qname of the key, which must match 
the 'name'
         *                                                 attribute on xsl:key
         * @param ref                      value that must match the value 
found by the
         *                                                 'match' attribute on 
xsl:key
  @@ -435,8 +435,8 @@
         */
        void
        getNodeSetByKey(
  -                     XalanNode*                                              
doc,
  -                     const XalanDOMString&                   name,
  +                     XalanDocument*                                  doc,
  +                     const XalanQName&                               qname,
                        const XalanDOMString&                   ref,
                        const PrefixResolver&                   resolver,
                        MutableNodeRefList&                             
nodelist,
  
  
  
  1.155     +15 -19    xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- XSLTEngineImpl.cpp        6 Sep 2002 01:39:18 -0000       1.154
  +++ XSLTEngineImpl.cpp        21 Sep 2002 01:24:41 -0000      1.155
  @@ -1635,21 +1635,13 @@
   
   
   void
  -XSLTEngineImpl::addResultNamespaceDecl(
  -                     const XalanDOMString&   prefix, 
  -             const XalanDOMString&   namespaceVal)
  -{
  -     m_resultNamespacesStack.addDeclaration(prefix, namespaceVal);
  -}
  -
  -
  -
  -void
   XSLTEngineImpl::addResultAttribute(
  -                     AttributeListImpl&      attList,
  -                     const XalanDOMString&   aname,
  -                     const XalanDOMString&   value)
  +                     AttributeListImpl&                      attList,
  +                     const XalanDOMString&           aname,
  +                     const XalanDOMChar*                     value)
   {
  +     assert(value != 0);
  +
        // Always exclude the implicit XML declaration...
        if (equals(aname, DOMServices::s_XMLNamespacePrefix) == false) 
        {
  @@ -1665,18 +1657,20 @@
                        const XalanDOMString* const             
currentDefaultNamespace =
                                                
getNamespaceForPrefix(s_emptyString);
   
  +                     const XalanDOMString::size_type         theLength = 
length(value);
  +
                        // Note that we use an empty string for the prefix, 
instead of "xmlns", since the
                        // prefix really is "".
  -                     if (length(value) != 0)
  +                     if (theLength != 0)
                        {
                                if (currentDefaultNamespace != 0 &&
  -                                     equals(*currentDefaultNamespace, value) 
== true)
  +                                     equals(*currentDefaultNamespace, value, 
theLength) == true)
                                {
                                        fExcludeAttribute = true;
                                }
                                else
                                {
  -                                     addResultNamespaceDecl(s_emptyString, 
value);
  +                                     addResultNamespaceDecl(s_emptyString, 
value, theLength);
                                }
                        }
                        else
  @@ -1686,7 +1680,7 @@
                                // the namespace declaration _and_ don't add 
the attribute.
                                if (currentDefaultNamespace != 0 && 
length(*currentDefaultNamespace) != 0)
                                {
  -                                     addResultNamespaceDecl(s_emptyString, 
value);
  +                                     addResultNamespaceDecl(s_emptyString, 
value, theLength);
                                }
                                else
                                {
  @@ -1706,9 +1700,11 @@
   
                        const XalanDOMString* const     theNamespace = 
getResultNamespaceForPrefix(prefix);
   
  -                     if (theNamespace == 0 || equals(*theNamespace, value) 
== false)
  +                     const XalanDOMString::size_type         theLength = 
length(value);
  +
  +                     if (theNamespace == 0 || equals(*theNamespace, value, 
theLength) == false)
                        {
  -                             addResultNamespaceDecl(prefix, value);
  +                             addResultNamespaceDecl(prefix, value, 
theLength);
                        }
                        else
                        {
  
  
  
  1.94      +72 -6     xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- XSLTEngineImpl.hpp        6 Sep 2002 01:39:18 -0000       1.93
  +++ XSLTEngineImpl.hpp        21 Sep 2002 01:24:41 -0000      1.94
  @@ -436,7 +436,32 @@
        void
        addResultNamespaceDecl(
                        const XalanDOMString&   prefix, 
  -                     const XalanDOMString&   namespaceVal);
  +                     const XalanDOMString&   namespaceVal)
  +     {
  +             addResultNamespaceDecl(
  +                     prefix,
  +                     namespaceVal.c_str(),
  +                     namespaceVal.length());
  +     }
  +
  +     /**
  +      * Add a namespace declaration to the namespace stack
  +      *
  +      * @param prefix namespace prefix
  +      * @param namespaceVal value of namespace
  +      * @param len length of namespace
  +      */
  +     void
  +     addResultNamespaceDecl(
  +                     const XalanDOMString&           prefix, 
  +                     const XalanDOMChar*                     namespaceVal,
  +                     XalanDOMString::size_type       len)
  +     {
  +             m_resultNamespacesStack.addDeclaration(
  +                     prefix,
  +                     namespaceVal,
  +                     len);
  +     }
   
        /**
         * Add attribute to attribute list, and if it is a namespace, add it to 
the
  @@ -448,9 +473,49 @@
         */
        void
        addResultAttribute(
  -                     AttributeListImpl&      attList,
  +                     AttributeListImpl&              attList,
                        const XalanDOMString&   aname,
  -                     const XalanDOMString&   value);
  +                     const XalanDOMString&   value)
  +     {
  +             addResultAttribute(
  +                     attList,
  +                     aname,
  +                     value.c_str());
  +     }
  +
  +     /**
  +      * Add attribute to attribute list, and if it is a namespace, add it to 
the
  +      * namespaces stack.
  +      *
  +      * @param attList attribute list added to
  +      * @param aname name of attribute
  +      * @param value value of attribute
  +      */
  +     void
  +     addResultAttribute(
  +                     AttributeListImpl&                      attList,
  +                     const XalanDOMString&           aname,
  +                     const XalanDOMChar*                     value);
  +
  +     /**
  +      * Add attribute to pending attributes list, and if it is a namespace, 
add
  +      * it to the namespaces stack.
  +      *
  +      * @param aname name of attribute
  +      * @param value value of attribute
  +      */
  +     void
  +     addResultAttribute(
  +                     const XalanDOMString&           aname,
  +                     const XalanDOMChar*                     value)
  +     {
  +             assert(m_outputContextStack.empty() == false);
  +
  +             addResultAttribute(
  +                             getPendingAttributesImpl(),
  +                             aname,
  +                             value);
  +     }
   
        /**
         * Add attribute to pending attributes list, and if it is a namespace, 
add
  @@ -466,9 +531,10 @@
        {
                assert(m_outputContextStack.empty() == false);
   
  -             addResultAttribute(getPendingAttributesImpl(),
  -                                                aname,
  -                                                value);
  +             addResultAttribute(
  +                             getPendingAttributesImpl(),
  +                             aname,
  +                             value);
        }
   
        void
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to