dbertoni    01/03/29 14:24:29

  Modified:    c/src/XSLT ElemApplyImport.cpp ElemApplyTemplates.cpp
                        ElemForEach.cpp ElemTemplateElement.cpp
                        ElemTemplateElement.hpp ElemTextLiteral.cpp
                        ElemTextLiteral.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetHandler.cpp StylesheetRoot.cpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
                        XSLTProcessor.hpp XSLTProcessorEnvSupport.hpp
                        XSLTProcessorEnvSupportDefault.cpp
                        XSLTProcessorEnvSupportDefault.hpp
  Log:
  Allow for support class instances to be changed.
  
  Revision  Changes    Path
  1.11      +2 -4      xml-xalan/c/src/XSLT/ElemApplyImport.cpp
  
  Index: ElemApplyImport.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyImport.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ElemApplyImport.cpp       2001/03/09 16:20:09     1.10
  +++ ElemApplyImport.cpp       2001/03/29 22:24:25     1.11
  @@ -123,12 +123,10 @@
        XalanNode* sourceNode = executionContext.getCurrentNode();
   
        transformChild(executionContext,
  -                                getStylesheet(),
  -                                0, 
  +                                *this, 
                                   0,                    
                                   DOMServices::getParentOfNode(*sourceNode), 
  -                                sourceNode, 
  -                                getXSLToken());   
  +                                sourceNode);   
   }
   
   
  
  
  
  1.15      +19 -16    xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp
  
  Index: ElemApplyTemplates.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemApplyTemplates.cpp    2001/03/09 16:20:09     1.14
  +++ ElemApplyTemplates.cpp    2001/03/29 22:24:25     1.15
  @@ -117,9 +117,9 @@
        if(0 == m_pSelectPattern)
        {
                m_pSelectPattern = 
constructionContext.createXPath(XALAN_STATIC_UCODE_STRING("node()"), *this);
  -
  -             assert(m_pSelectPattern != 0);
        }
  +
  +     assert(m_pSelectPattern != 0);
   }
   
   
  @@ -141,13 +141,16 @@
   void
   ElemApplyTemplates::execute(StylesheetExecutionContext&              
executionContext) const
   {
  -     XalanNode* sourceNode = executionContext.getCurrentNode();
  +     assert(m_pSelectPattern != 0);
   
        if(0 != executionContext.getTraceListeners())
        {
                executionContext.fireTraceEvent(TracerEvent(
                  executionContext, *this));
        }
  +
  +     XalanNode* const        sourceNode = executionContext.getCurrentNode();
  +
        if (0 != sourceNode)
        {
                // Dragons here.  Push the params & stack frame, but then 
execute the
  @@ -161,23 +164,21 @@
                        sourceNode,
                        this);
   
  -             // Initialize the member mode of execution context.
  -             if (executionContext.getCurrentMode() == 0)
  -                     executionContext.setCurrentMode(&m_mode);
  +             assert(executionContext.getCurrentMode() != 0);
   
                if (m_isDefaultTemplate == false &&           
                        !m_mode.equals(*executionContext.getCurrentMode()))
                {
  -                     const QName* oldMode = 
executionContext.getCurrentMode();
  +                     const QName* const      oldMode = 
executionContext.getCurrentMode();
  +
                        executionContext.setCurrentMode(&m_mode);
   
                        transformSelectedChildren(
                                executionContext,
  -                             getStylesheet(),
                                *this,
  -                             0,                              
  -                             sourceNode,                             
  -                             m_pSelectPattern,
  +                             0,
  +                             sourceNode,
  +                             *m_pSelectPattern,
                                Constants::ELEMNAME_APPLY_TEMPLATES,
                                thePushPop.getStackFrameIndex());
   
  @@ -187,18 +188,20 @@
                {
                        transformSelectedChildren(
                                executionContext,
  -                             getStylesheet(),
                                *this,
  -                             0,                              
  -                             sourceNode,                             
  -                             m_pSelectPattern,
  +                             0,
  +                             sourceNode,
  +                             *m_pSelectPattern,
                                Constants::ELEMNAME_APPLY_TEMPLATES,
                                thePushPop.getStackFrameIndex());
                }
        }
       else
        {
  -             executionContext.error("sourceNode is null in 
handleApplyTemplatesInstruction!");
  +             executionContext.error(
  +                     "There is no current node in 
ElemApplyTemplates::execute()",
  +                     sourceNode,
  +                     this);
        }
   }
   
  
  
  
  1.12      +8 -8      xml-xalan/c/src/XSLT/ElemForEach.cpp
  
  Index: ElemForEach.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ElemForEach.cpp   2001/03/09 16:20:02     1.11
  +++ ElemForEach.cpp   2001/03/29 22:24:25     1.12
  @@ -157,26 +157,26 @@
   void
   ElemForEach::execute(StylesheetExecutionContext&             
executionContext) const
   {
  -     XalanNode* sourceNode = executionContext.getCurrentNode();
  +     assert(m_pSelectPattern != 0);
   
  +     XalanNode* const        sourceNode = executionContext.getCurrentNode();
  +
        if (sourceNode != 0)
        {
  -             assert(m_pSelectPattern != 0);
  -
                transformSelectedChildren(
                        executionContext,
  -                     getStylesheet(),
                        *this,
                        this,
                        sourceNode,
  -                     m_pSelectPattern,
  +                     *m_pSelectPattern,
                        Constants::ELEMNAME_FOREACH,
                        executionContext.getCurrentStackFrameIndex());
        }
       else
       {
  -             executionContext.error("sourceNode is null in 
handleApplyTemplatesInstruction!",
  -                                                        sourceNode, 
  -                                                        this);
  +             executionContext.error(
  +                     "There is no current node in ElemForEach::execute()!",
  +                     sourceNode, 
  +                     this);
       }
   }
  
  
  
  1.52      +142 -183  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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- ElemTemplateElement.cpp   2001/03/09 16:19:58     1.51
  +++ ElemTemplateElement.cpp   2001/03/29 22:24:25     1.52
  @@ -107,7 +107,8 @@
   
   
   
  -const XalanDOMString ElemTemplateElement::s_emptyString;
  +const XalanDOMString                                         
ElemTemplateElement::s_emptyString;
  +const NodeSorter::NodeSortKeyVectorType              
ElemTemplateElement::s_dummyKeys;
   
   
   
  @@ -150,6 +151,14 @@
   
   
   bool
  +ElemTemplateElement::isWhitespace() const
  +{
  +     return false;
  +}
  +
  +
  +
  +bool
   ElemTemplateElement::isAttrOK(
                        int                                             tok,
                        const XalanDOMChar*             attrName,
  @@ -271,8 +280,7 @@
   
   
   void
  -ElemTemplateElement::execute(
  -                     StylesheetExecutionContext&             
executionContext) const
  +ElemTemplateElement::execute(StylesheetExecutionContext&     
executionContext) const
   {
        if(0 != executionContext.getTraceListeners())
       {
  @@ -301,7 +309,7 @@
                StylesheetExecutionContext&             executionContext,
                XalanNode*                                              
sourceNode) const
   {
  -     XPathExecutionContext::CurrentNodeSetAndRestore 
theCurrentNodeSetAndRestore(executionContext, sourceNode);
  +     const XPathExecutionContext::CurrentNodeSetAndRestore   
theCurrentNodeSetAndRestore(executionContext, sourceNode);
   
        executeChildren(executionContext);
   }
  @@ -417,7 +425,8 @@
   {
        assert(newChild != 0);
   
  -     if (childTypeAllowed(newChild->getXSLToken()) == false)
  +     if (newChild->isWhitespace() == false &&
  +             childTypeAllowed(newChild->getXSLToken()) == false)
        {
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
        }
  @@ -556,24 +565,16 @@
   void
   ElemTemplateElement::transformSelectedChildren(
                        StylesheetExecutionContext&             
executionContext,
  -                     const Stylesheet&                               
stylesheetTree,
                        const ElemTemplateElement&              xslInstruction,
                        const ElemTemplateElement*              theTemplate,
                        XalanNode*                                              
sourceNodeContext,                      
  -                     const XPath*                                    
selectPattern,
  +                     const XPath&                                    
selectPattern,
                        int                                                     
        xslToken,
                        int                                                     
        selectStackFrameIndex) const
   {
  -     typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex 
        SetAndRestoreCurrentStackFrameIndex;
  -
  -     // Sort the nodes according to the xsl:sort method
  -     const int       tok = xslInstruction.getXSLToken();
  -
  -     NodeSorter::NodeSortKeyVectorType       keys;
  -
        // @@ JMD: Now in method processSortKeys in java ...
  -     if((Constants::ELEMNAME_APPLY_TEMPLATES == tok) ||
  -             (Constants::ELEMNAME_FOREACH == tok))
  +     if(Constants::ELEMNAME_APPLY_TEMPLATES == xslToken ||
  +        Constants::ELEMNAME_FOREACH == xslToken)
        {
                const ElemForEach* foreach =
   #if defined(XALAN_OLD_STYLE_CASTS)
  @@ -582,160 +583,166 @@
                        static_cast<const ElemForEach*>(&xslInstruction);
   #endif
   
  -             const unsigned int nChildren = foreach->getSortElems().size();
  +             const unsigned int      nChildren = 
foreach->getSortElems().size();
   
  -             // Reserve the space now...
  -             keys.reserve(nChildren);
  -
  -             // March backwards, performing a sort on each xsl:sort child.
  -             // Probably not the most efficient method.
  -             for(unsigned int i = 0; i < nChildren; i++)
  +             if (nChildren == 0)
                {
  -                     ElemSort* sort = foreach->getSortElems()[i];
  -                     assert(sort != 0);
  +                     doTransformSelectedChildren(
  +                                     executionContext,
  +                                     xslInstruction,
  +                                     theTemplate,
  +                                     sourceNodeContext,
  +                                     selectPattern,
  +                                     s_dummyKeys,
  +                                     selectStackFrameIndex);
  +             }
  +             else
  +             {
  +                     NodeSorter::NodeSortKeyVectorType       keys;
   
  -                     const AVT* avt = 0;
  +                     // Reserve the space now...
  +                     keys.reserve(nChildren);
   
  -                     XalanDOMString langString;
  -                                             
  -                     avt = sort->getLangAVT();
  +                     // Get some temporary strings to use for evaluting the 
AVTs...
  +                     XPathExecutionContext::GetAndReleaseCachedString        
theTemp1(executionContext);
   
  -                     if(0 != avt)
  -                     {
  -                             avt->evaluate(langString, sourceNodeContext, 
xslInstruction, executionContext);
  -                     }
  +                     XalanDOMString&         langString = theTemp1.get();
   
  -                     XalanDOMString dataTypeString;
  +                     XPathExecutionContext::GetAndReleaseCachedString        
theTemp2(executionContext);
   
  -                     avt = sort->getDataTypeAVT();
  +                     XalanDOMString&         scratchString = theTemp2.get();
   
  -                     if(0 != avt)
  +                     // March backwards, performing a sort on each xsl:sort 
child.
  +                     // Probably not the most efficient method.
  +                     for(unsigned int i = 0; i < nChildren; i++)
                        {
  -                             avt->evaluate(dataTypeString, 
sourceNodeContext, xslInstruction, executionContext);
  -                     }                       
  +                             const ElemSort* const   sort = 
foreach->getSortElems()[i];
  +                             assert(sort != 0);
   
  -                     bool treatAsNumbers = ((!isEmpty(dataTypeString)) && 
equals(dataTypeString,Constants::ATTRVAL_DATATYPE_NUMBER)) ? 
  -                             true : false;
  +                             const AVT* avt = sort->getLangAVT();
   
  -                     XalanDOMString orderString;
  +                             if(0 != avt)
  +                             {
  +                                     avt->evaluate(langString, 
sourceNodeContext, xslInstruction, executionContext);
  +                             }
   
  -                     avt = sort->getOrderAVT();
  +                             avt = sort->getDataTypeAVT();
   
  -                     if(0 != avt)
  -                     {
  -                             avt->evaluate(orderString, sourceNodeContext, 
xslInstruction, executionContext);
  -                     }                       
  +                             if(0 != avt)
  +                             {
  +                                     avt->evaluate(scratchString, 
sourceNodeContext, xslInstruction, executionContext);
  +                             }                       
  +
  +                             const bool      treatAsNumbers = 
!isEmpty(scratchString) && equals(scratchString, 
Constants::ATTRVAL_DATATYPE_NUMBER) ?
  +                                     true : false;
   
  -                     bool descending = ((!isEmpty(orderString)) &&  
equals(orderString,Constants::ATTRVAL_ORDER_DESCENDING))? 
  -                             true : false;
  +                             clear(scratchString);
   
  -                     assert(sort->getSelectPattern() != 0);
  +                             avt = sort->getOrderAVT();
  +
  +                             if(0 != avt)
  +                             {
  +                                     avt->evaluate(scratchString, 
sourceNodeContext, xslInstruction, executionContext);
  +                             }                       
   
  -                     NodeSortKey key(executionContext, 
  -                             *sort->getSelectPattern(), 
  -                             treatAsNumbers, 
  -                             descending, 
  -                             langString, 
  -                             xslInstruction);
  +                             const bool      descending = 
!isEmpty(scratchString) && equals(scratchString, 
Constants::ATTRVAL_ORDER_DESCENDING) ?
  +                                     true : false;
  +
  +                             clear(scratchString);
  +
  +                             assert(sort->getSelectPattern() != 0);
  +
  +                             keys.push_back(
  +                                     NodeSortKey(
  +                                             executionContext, 
  +                                             *sort->getSelectPattern(), 
  +                                             treatAsNumbers, 
  +                                             descending, 
  +                                             langString, 
  +                                             xslInstruction));
  +                     }
   
  -                     keys.push_back(key);
  +                     doTransformSelectedChildren(
  +                                     executionContext,
  +                                     xslInstruction,
  +                                     theTemplate,
  +                                     sourceNodeContext,
  +                                     selectPattern,
  +                                     keys,
  +                                     selectStackFrameIndex);
                }
        }
  +     else
  +     {
  +             doTransformSelectedChildren(
  +                             executionContext,
  +                             xslInstruction,
  +                             theTemplate,
  +                             sourceNodeContext,
  +                             selectPattern,
  +                             s_dummyKeys,
  +                             selectStackFrameIndex);
  +     }
  +}
   
  -/*
  -     @@@ JMD: This is newer java code that is not implemented in C++; so, the
  -     manipulation of the current stack frame index really does nothing now, 
it's
  -     just a placeholder for future implementation
   
  -    // We can only do callbacks if the node list isn't sorted.
  -    NodeCallback callback = (null == keys) ? this : null;
  -*/
   
  -     if (0 != selectPattern)
  -     {
  -             XObjectPtr      theXObject;
  +void
  +ElemTemplateElement::doTransformSelectedChildren(
  +                     StylesheetExecutionContext&                             
        executionContext,
  +                     const ElemTemplateElement&                              
        xslInstruction,
  +                     const ElemTemplateElement*                              
        theTemplate,
  +                     XalanNode*                                              
                        sourceNodeContext,
  +                     const XPath&                                            
                selectPattern,
  +                     const NodeSorter::NodeSortKeyVectorType&        keys,
  +                     int                                                     
                                selectStackFrameIndex) const
  +{
  +     typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex 
        SetAndRestoreCurrentStackFrameIndex;
   
  -             {
  -                     SetAndRestoreCurrentStackFrameIndex             
theSetAndRestore(
  +     XObjectPtr      theXObject;
  +
  +     {
  +             SetAndRestoreCurrentStackFrameIndex             
theSetAndRestore(
                                        executionContext,
                                        selectStackFrameIndex);
  -
  -     /*
  -             @@@ JMD: This is newer java code that is not implemented in 
C++; the
  -             callback mechanism may affect the correct positioning of the 
stack frame and
  -             may be why the parameters aren't working right
  -
  -               // Optimization note: is there a way we can keep from 
creating 
  -               // a new callback context every time?
  -               TemplateElementContext callbackContext 
  -                     = (null != callback) 
  -                              ? new TemplateElementContext(stylesheetTree, 
xslInstruction,
  -                                              template, sourceNodeContext, 
xslToken, tcontext,
  -                                              savedCurrentStackFrameIndex) : 
null;
  -     */
   
  -                     theXObject = 
  -                                     selectPattern->execute(
  +             theXObject = 
  +                                     selectPattern.execute(
                                                sourceNodeContext,
                                                xslInstruction,
                                                executionContext);
  -             }
  -
  -             // @@ JMD: Should this be an assert ??
  -             if (theXObject.null() == false)
  -             {
  -                     const NodeRefListBase&  sourceNodes = 
theXObject->nodeset();
  -
  -                     if(0 != executionContext.getTraceListeners())
  -                     {
  -                             executionContext.fireSelectEvent(
  -                                             
SelectionEvent(executionContext, 
  -                                                     sourceNodeContext,
  -                                                     *this,
  -                                                     
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
  -                                                     *selectPattern,
  -                                                     theXObject));
  -                     }
  +     }
   
  -                     const unsigned int      nNodes = 
sourceNodes.getLength();
  +     // @@ JMD: Should this be an assert ??
  +     if (theXObject.null() == false)
  +     {
  +             const NodeRefListBase&  sourceNodes = theXObject->nodeset();
   
  -                     if (nNodes > 0)
  -                     {
  -                             doTransformSelectedChildren(
  -                                             executionContext,
  -                                             stylesheetTree,
  -                                             xslInstruction,
  -                                             theTemplate,
  +             if(0 != executionContext.getTraceListeners())
  +             {
  +                     executionContext.fireSelectEvent(
  +                                     SelectionEvent(executionContext, 
                                                sourceNodeContext,
  -                                             xslToken,
  -                                             selectStackFrameIndex,
  -                                             keys,
  -                                             sourceNodes,
  -                                             nNodes);
  -                     }
  +                                             *this,
  +                                             
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
  +                                             selectPattern,
  +                                             theXObject));
                }
  -     }
  -     else if (keys.size() > 0)
  -     {
  -             const XalanNodeList* const      childNodes =
  -                                             
sourceNodeContext->getChildNodes();
   
  -             const unsigned int      nNodes = childNodes->getLength();
  +             const unsigned int      nNodes = sourceNodes.getLength();
   
                if (nNodes > 0)
                {
                        doTransformSelectedChildren(
                                        executionContext,
  -                                     stylesheetTree,
                                        xslInstruction,
                                        theTemplate,
                                        sourceNodeContext,
  -                                     xslToken,
                                        selectStackFrameIndex,
                                        keys,
  -                                     *childNodes,
  +                                     sourceNodes,
                                        nNodes);
  -                     }
  +             }
        }
   }
   
  @@ -744,11 +751,9 @@
   void
   ElemTemplateElement::doTransformSelectedChildren(
                        StylesheetExecutionContext&                             
        executionContext,
  -                     const Stylesheet&                                       
                stylesheetTree,
                        const ElemTemplateElement&                              
        xslInstruction,
                        const ElemTemplateElement*                              
        theTemplate,
                        XalanNode*                                              
                        sourceNodeContext,
  -                     int                                                     
                                xslToken,
                        int                                                     
                                selectStackFrameIndex,
                        const NodeSorter::NodeSortKeyVectorType&        keys,
                        const NodeRefListBase&                                  
        sourceNodes,
  @@ -780,11 +785,9 @@
   
                doTransformSelectedChildren(
                        executionContext,
  -                     stylesheetTree,
                        xslInstruction,
                        theTemplate,
                        sourceNodeContext,
  -                     xslToken,
                        *sortedSourceNodes,
                        sourceNodesCount);
        }
  @@ -792,11 +795,9 @@
        {
                doTransformSelectedChildren(
                        executionContext,
  -                     stylesheetTree,
                        xslInstruction,
                        theTemplate,
                        sourceNodeContext,
  -                     xslToken,
                        sourceNodes,
                        sourceNodesCount);
        }
  @@ -806,46 +807,10 @@
   
   void
   ElemTemplateElement::doTransformSelectedChildren(
  -                     StylesheetExecutionContext&                             
        executionContext,
  -                     const Stylesheet&                                       
                stylesheetTree,
  -                     const ElemTemplateElement&                              
        xslInstruction,
  -                     const ElemTemplateElement*                              
        theTemplate,
  -                     XalanNode*                                              
                        sourceNodeContext,
  -                     int                                                     
                                xslToken,
  -                     int                                                     
                                selectStackFrameIndex,
  -                     const NodeSorter::NodeSortKeyVectorType&        keys,
  -                     const XalanNodeList&                                    
        childNodes,
  -                     unsigned int                                            
                childNodeCount) const
  -{
  -     typedef StylesheetExecutionContext::BorrowReturnMutableNodeRefList      
BorrowReturnMutableNodeRefList;
  -
  -     BorrowReturnMutableNodeRefList  sourceNodes(executionContext);
  -
  -     *sourceNodes = &childNodes;
  -
  -     doTransformSelectedChildren(
  -                     executionContext,
  -                     stylesheetTree,
  -                     xslInstruction,
  -                     theTemplate,
  -                     sourceNodeContext,
  -                     xslToken,
  -                     selectStackFrameIndex,
  -                     keys,
  -                     *sourceNodes,
  -                     childNodeCount);
  -}
  -
  -
  -
  -void
  -ElemTemplateElement::doTransformSelectedChildren(
                        StylesheetExecutionContext&                     
executionContext,
  -                     const Stylesheet&                                       
stylesheetTree,
                        const ElemTemplateElement&                      
xslInstruction,
                        const ElemTemplateElement*                      
theTemplate,
                        XalanNode*                                              
        sourceNodeContext,
  -                     int                                                     
                xslToken,
                        const NodeRefListBase&                          
sourceNodes,
                        unsigned int                                            
sourceNodesCount) const
   {
  @@ -865,22 +830,18 @@
        {
                XalanNode* const                childNode = sourceNodes.item(i);
                assert(childNode != 0);
  -
  -             XalanDocument* const    ownerDoc = 
childNode->getOwnerDocument();
   
  -             if(XalanNode::DOCUMENT_NODE != childNode->getNodeType() && 
ownerDoc == 0)
  +             if(XalanNode::DOCUMENT_NODE != childNode->getNodeType() && 
childNode->getOwnerDocument() == 0)
                {
                        error("Child node does not have an owner document!");
                }
   
                transformChild(
                                executionContext,
  -                             stylesheetTree,
  -                             &xslInstruction,
  +                             xslInstruction,
                                theTemplate,
                                sourceNodeContext, 
  -                             childNode,
  -                             xslToken);
  +                             childNode);
        }
   }
   
  @@ -888,13 +849,11 @@
   
   bool
   ElemTemplateElement::transformChild(
  -                     StylesheetExecutionContext& executionContext,
  -                     const Stylesheet&                       
stylesheet_tree, 
  -                     const ElemTemplateElement*      /* xslInstruction */,
  -                     const ElemTemplateElement*      theTemplate,
  -                     XalanNode*                                      
selectContext,
  -                     XalanNode*                                      child,
  -                     int                                                     
xslToken) const
  +                     StylesheetExecutionContext&             
executionContext,
  +                     const ElemTemplateElement&              xslInstruction,
  +                     const ElemTemplateElement*              theTemplate,
  +                     XalanNode*                                              
selectContext,
  +                     XalanNode*                                              
child) const
   {
        const XalanNode::NodeType       nodeType = child->getNodeType();
   
  @@ -904,10 +863,10 @@
                // element, and call buildResultFromTemplate.
                const Stylesheet*       foundStylesheet = 0;
   
  -             const bool                      isApplyImports = xslToken == 
Constants::ELEMNAME_APPLY_IMPORTS;
  +             const bool                      isApplyImports = 
xslInstruction.getXSLToken() == Constants::ELEMNAME_APPLY_IMPORTS;
   
                const Stylesheet*       stylesheetTree = isApplyImports ?
  -                                                             
&stylesheet_tree :
  +                                                             
&xslInstruction.getStylesheet() :
                                                                
&getStylesheet().getStylesheetRoot();
   
                theTemplate = stylesheetTree->findTemplate(
  
  
  
  1.27      +34 -30    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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ElemTemplateElement.hpp   2001/03/09 16:19:57     1.26
  +++ ElemTemplateElement.hpp   2001/03/29 22:24:26     1.27
  @@ -248,13 +248,21 @@
        }
   
        /** 
  +      * Tell if the element will generate text which is XML whitespace.
  +      * 
  +      * @return true if the text is pure whitespace
  +      */
  +     virtual bool
  +     isWhitespace() const;
  +
  +     /** 
         * Tell if the string is whitespace.
         * 
         * @param string string in question
         * @return true if the string is pure whitespace
         */
  -     static bool
  -     isWhitespace(const XalanDOMString& theString);
  +//   static bool
  +//   isWhitespace(const XalanDOMString& theString);
   
        /** 
         * Throw a template element runtime error.  
  @@ -643,61 +651,51 @@
         * Perform a query if needed, and call transformChild for each child.
         * 
         * @param executionContext  The current execution context
  -      * @param stylesheetTree The owning stylesheet tree.
         * @param xslInstruction The stylesheet element context (deprecated -- 
I do 
         *      not think we need this).
         * @param template The owning template context.
         * @param sourceNodeContext The current source node context.
         * @param selectPattern The XPath with which to perform the selection.
  -      * @param xslToken The current XSLT instruction (deprecated -- I do not 
    
  -      *     think we want this).
  +      * @param xslToken The current XSLT instruction
         * @param selectStackFrameIndex stack frame context for executing the
         *                              select statement
         */
        void
        transformSelectedChildren(
                        StylesheetExecutionContext&             
executionContext,
  -                     const Stylesheet&                               
stylesheetTree,
                        const ElemTemplateElement&              xslInstruction,
                        const ElemTemplateElement*              theTemplate,
                        XalanNode*                                              
sourceNodeContext,
  -                     const XPath*                                    
selectPattern,
  +                     const XPath&                                    
selectPattern,
                        int                                                     
        xslToken,
                        int                                                     
        selectStackFrameIndex) const;
   
        /**
         * Perform a query if needed, and call transformChild for each child.
         * 
  -      * @param executionContext The current execution context
  -      * @param stylesheetTree The owning stylesheet tree.
  +      * @param executionContext  The current execution context
         * @param xslInstruction The stylesheet element context (deprecated -- 
I do 
         *      not think we need this).
         * @param template The owning template context.
         * @param sourceNodeContext The current source node context.
         * @param selectPattern The XPath with which to perform the selection.
  -      * @param xslToken The current XSLT instruction (deprecated -- I do not 
    
  -      *     think we want this).
         * @param selectStackFrameIndex stack frame context for executing the
         *                              select statement
         */
        void
        doTransformSelectedChildren(
                        StylesheetExecutionContext&                             
        executionContext,
  -                     const Stylesheet&                                       
                stylesheetTree,
                        const ElemTemplateElement&                              
        xslInstruction,
                        const ElemTemplateElement*                              
        theTemplate,
                        XalanNode*                                              
                        sourceNodeContext,
  -                     int                                                     
                                xslToken,
  -                     int                                                     
                                selectStackFrameIndex,
  +                     const XPath&                                            
                selectPattern,
                        const NodeSorter::NodeSortKeyVectorType&        keys,
  -                     const NodeRefListBase&                                  
        sourceNodes,
  -                     unsigned int                                            
                sourceNodesCount) const;
  +                     int                                                     
                                selectStackFrameIndex) const;
   
        /**
         * Perform a query if needed, and call transformChild for each child.
         * 
         * @param executionContext The current execution context
  -      * @param stylesheetTree The owning stylesheet tree.
         * @param xslInstruction The stylesheet element context (deprecated -- 
I do 
         *      not think we need this).
         * @param template The owning template context.
  @@ -707,28 +705,37 @@
         *     think we want this).
         * @param selectStackFrameIndex stack frame context for executing the
         *                              select statement
  +      * @param keys Any sort keys that should be applied
  +      * @param sourceNodesCount The number of source nodes.
         */
        void
        doTransformSelectedChildren(
                        StylesheetExecutionContext&                             
        executionContext,
  -                     const Stylesheet&                                       
                stylesheetTree,
                        const ElemTemplateElement&                              
        xslInstruction,
                        const ElemTemplateElement*                              
        theTemplate,
                        XalanNode*                                              
                        sourceNodeContext,
  -                     int                                                     
                                xslToken,
                        int                                                     
                                selectStackFrameIndex,
                        const NodeSorter::NodeSortKeyVectorType&        keys,
  -                     const XalanNodeList&                                    
        childNodes,
  -                     unsigned int                                            
                childNodeCount) const;
  +                     const NodeRefListBase&                                  
        sourceNodes,
  +                     unsigned int                                            
                sourceNodesCount) const;
   
  +     /**
  +      * Perform a query if needed, and call transformChild for each child.
  +      * 
  +      * @param executionContext The current execution context
  +      * @param xslInstruction The stylesheet element context (deprecated -- 
I do 
  +      *      not think we need this).
  +      * @param theTemplate The owning template context.
  +      * @param sourceNodeContext The current source node context.
  +      * @param sourceNodes The source nodes to transform.
  +      * @param sourceNodesCount The count of source nodes to transform.
  +      */
        void
        doTransformSelectedChildren(
                        StylesheetExecutionContext&                     
executionContext,
  -                     const Stylesheet&                                       
stylesheetTree,
                        const ElemTemplateElement&                      
xslInstruction,
                        const ElemTemplateElement*                      
theTemplate,
                        XalanNode*                                              
        sourceNodeContext,
  -                     int                                                     
                xslToken,
                        const NodeRefListBase&                          
sourceNodes,
                        unsigned int                                            
sourceNodesCount) const;
   
  @@ -737,25 +744,20 @@
         * template and process the contents.
         * 
         * @param executionContext The current execution context
  -      * @param stylesheetTree The current Stylesheet object.
         * @param xslInstruction The calling element (deprecated -- I dont 
think we 
         *      need this).
         * @param template The template to use if xsl:for-each, or null.
         * @param selectContext The selection context.
         * @param child The source context node.
  -      * @param xslToken ELEMNAME_APPLY_TEMPLATES, ELEMNAME_APPLY_IMPORTS, or 
    
  -      *      ELEMNAME_FOREACH.
         * @return true if applied a template, false if not.
         */
        bool
        transformChild(
                        StylesheetExecutionContext&             
executionContext,
  -                     const Stylesheet&                               
stylesheetTree,
  -                     const ElemTemplateElement*              xslInstruction,
  +                     const ElemTemplateElement&              xslInstruction,
                        const ElemTemplateElement*              theTemplate,
                        XalanNode*                                              
selectContext,
  -                     XalanNode*                                              
child,
  -                     int                                                     
        xslToken) const;
  +                     XalanNode*                                              
child) const;
   
        /**
         * Given an xsl token type, determine whether or not a child
  @@ -802,6 +804,8 @@
        XalanEmptyNamedNodeMap  m_fakeAttributes;
   
        const XalanDOMString    m_baseIndentifier;
  +
  +     static const NodeSorter::NodeSortKeyVectorType  s_dummyKeys;
   };
   
   
  
  
  
  1.13      +8 -0      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ElemTextLiteral.cpp       2001/03/09 16:19:57     1.12
  +++ ElemTextLiteral.cpp       2001/03/29 22:24:26     1.13
  @@ -111,6 +111,14 @@
   
   
   
  +bool
  +ElemTextLiteral::isWhitespace() const
  +{
  +     return isXMLWhitespace(&*m_ch.begin(), 0, m_ch.size());
  +}
  +
  +
  +
   void
   ElemTextLiteral::execute(StylesheetExecutionContext&         
executionContext) const
   {
  
  
  
  1.11      +3 -0      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ElemTextLiteral.hpp       2001/03/09 16:19:57     1.10
  +++ ElemTextLiteral.hpp       2001/03/29 22:24:26     1.11
  @@ -128,6 +128,9 @@
                return m_ch;
        }
   
  +     virtual bool
  +     isWhitespace() const;
  +
        // These methods are inherited from ElemTemplateElement ...
        
        virtual const XalanDOMString&
  
  
  
  1.14      +17 -9     
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetConstructionContextDefault.cpp  2001/01/24 16:10:51     1.13
  +++ StylesheetConstructionContextDefault.cpp  2001/03/29 22:24:26     1.14
  @@ -92,7 +92,8 @@
        m_xpathEnvSupport(xpathEnvSupport),
        m_xpathFactory(xpathFactory),
        m_xpathProcessor(new XPathProcessorImpl),
  -     m_stylesheets()
  +     m_stylesheets(),
  +     m_tempBuffer()
   {
   }
   
  @@ -252,7 +253,7 @@
   int
   StylesheetConstructionContextDefault::getAttrTok(const XalanDOMString&       
name) const
   {
  -     return m_processor.getAttrTok(XalanDOMString(name));
  +     return m_processor.getAttrTok(name);
   }
   
   
  @@ -262,8 +263,14 @@
   {
        assert(name != 0);
   
  -     // $$$ ToDo: Explicit XalanDOMString constructor
  -     return m_processor.getAttrTok(XalanDOMString(name));
  +     // $$$ ToDo: Change getAttrTok() to take a const XalanDOMChar*
  +#if defined(XALAN_NO_MUTABLE)
  +     assign((XalanDOMString&)m_tempBuffer, name);
  +#else
  +     assign(m_tempBuffer, name);
  +#endif
  +
  +     return m_processor.getAttrTok(m_tempBuffer);
   }
   
   
  @@ -338,8 +345,9 @@
   {
        assert(str != 0);
   
  -             // $$$ ToDo: Explicit XalanDOMString constructor
  -     return createMatchPattern(XalanDOMString(str), resolver);
  +     assign(m_tempBuffer, str);
  +
  +     return createMatchPattern(m_tempBuffer, resolver);
   }
   
   
  @@ -351,7 +359,6 @@
   {
        XPath* const    xpath = m_xpathFactory.create();
   
  -             // $$$ ToDo: Explicit XalanDOMString constructor
        m_xpathProcessor->initXPath(*xpath,
                                                                str,
                                                                resolver,
  @@ -370,9 +377,10 @@
                        const PrefixResolver&   resolver)
   {
        assert(str != 0);
  +
  +     assign(m_tempBuffer, str);
   
  -     // $$$ ToDo: Explicit XalanDOMString constructor
  -     return createXPath(XalanDOMString(str), resolver);
  +     return createXPath(m_tempBuffer, resolver);
   }
   
   
  
  
  
  1.16      +2 -0      
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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StylesheetConstructionContextDefault.hpp  2000/11/02 01:46:27     1.15
  +++ StylesheetConstructionContextDefault.hpp  2001/03/29 22:24:26     1.16
  @@ -267,6 +267,8 @@
        XPathProcessAutoPtr                                     
m_xpathProcessor;
   
        StylesheetSetType                                       m_stylesheets;
  +
  +     mutable XalanDOMString                          m_tempBuffer;
   };
   
   
  
  
  
  1.50      +30 -8     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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- StylesheetExecutionContext.hpp    2001/03/06 21:22:59     1.49
  +++ StylesheetExecutionContext.hpp    2001/03/29 22:24:26     1.50
  @@ -1243,6 +1243,21 @@
   
        /**
         * Compare two strings using the collation of the
  +      * supplied locale.
  +      *
  +      * @param theLHS a string to compare
  +      * @param theRHS a string to compare
  +      * @param theLocal a string that specifies the locale
  +      * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 
if theLHS is after theRHS
  +      */
  +     virtual int
  +     collationCompare(
  +                     const XalanDOMString&   theLHS,
  +                     const XalanDOMString&   theRHS,
  +                     const XalanDOMString&   theLocale) = 0;
  +
  +     /**
  +      * Compare two strings using the collation of the
         * current locale.
         *
         * @param theLHS a string to compare
  @@ -1255,6 +1270,21 @@
                        const XalanDOMChar*             theRHS) = 0;
   
        /**
  +      * Compare two strings using the collation of the
  +      * current locale.
  +      *
  +      * @param theLHS a string to compare
  +      * @param theRHS a string to compare
  +      * @param theLocal a string that specifies the locale
  +      * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 
if theLHS is after theRHS
  +      */
  +     virtual int
  +     collationCompare(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             theLocale) = 0;
  +
  +     /**
         * Determine if a KeyDeclaration is being constructed.
         *
         * @param The KeyDeclaration in question.
  @@ -1373,14 +1403,6 @@
                        const XalanDOMString&                   functionName,
                        XalanNode*                                              
context,
                        const XObjectArgVectorType&             argVec) = 0;
  -
  -     virtual XLocator*
  -     getXLocatorFromNode(const XalanNode*    node) const = 0;
  -
  -     virtual void
  -     associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator) = 0;
   
        virtual XalanDocument*
        parseXML(
  
  
  
  1.60      +256 -84   
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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- StylesheetExecutionContextDefault.cpp     2001/03/11 16:47:51     1.59
  +++ StylesheetExecutionContextDefault.cpp     2001/03/29 22:24:26     1.60
  @@ -131,7 +131,7 @@
                                                                   
theCurrentNode,
                                                                   
theContextNodeList,
                                                                   
thePrefixResolver),
  -     m_xsltProcessor(xsltProcessor),
  +     m_xsltProcessor(&xsltProcessor),
        m_rootDocument(0),
        m_elementRecursionStack(),
        m_prefixResolver(0),
  @@ -150,7 +150,37 @@
        m_sourceTreeResultTreeFactory(),
        m_mode(0)
   {
  -     m_mode = 0;
  +}
  +
  +
  +
  +StylesheetExecutionContextDefault::StylesheetExecutionContextDefault(
  +                     XalanNode*                              theCurrentNode,
  +                     const NodeRefListBase*  theContextNodeList,
  +                     const PrefixResolver*   thePrefixResolver) :
  +     StylesheetExecutionContext(),
  +     m_xpathExecutionContextDefault(theCurrentNode,
  +                                                                
theContextNodeList,
  +                                                                
thePrefixResolver),
  +     m_xsltProcessor(0),
  +     m_rootDocument(0),
  +     m_elementRecursionStack(),
  +     m_prefixResolver(0),
  +     m_stylesheetRoot(0),
  +     m_formatterListeners(),
  +     m_printWriters(),
  +     m_outputStreams(),
  +     m_collationCompareFunctor(0),
  +     m_variablesStack(),
  +     m_matchPatternCache(),
  +     m_keyTables(),
  +     m_keyDeclarationSet(),
  +     m_countersTable(),
  +     m_useDOMResultTreeFactory(false),
  +     m_ignoreHTMLElementNamespaces(false),
  +     m_sourceTreeResultTreeFactory(),
  +     m_mode(0)
  +{
   }
   
   
  @@ -165,7 +195,9 @@
   bool
   StylesheetExecutionContextDefault::getQuietConflictWarnings() const
   {
  -     return m_xsltProcessor.getQuietConflictWarnings();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getQuietConflictWarnings();
   }
   
   
  @@ -189,7 +221,9 @@
   XalanDocument*
   StylesheetExecutionContextDefault::createDocument() const
   {
  -     return m_xsltProcessor.getXMLParserLiaison().createDocument();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getXMLParserLiaison().createDocument();
   }
   
   
  @@ -197,19 +231,20 @@
   void
   StylesheetExecutionContextDefault::setStylesheetRoot(const StylesheetRoot*   
theStylesheet)
   {
  +     assert(m_xsltProcessor != 0);
        assert(theStylesheet == 0 || theStylesheet->isRoot() == true);
   
        m_stylesheetRoot = theStylesheet;
   
  -     m_xsltProcessor.setStylesheetRoot(theStylesheet);
  +     m_xsltProcessor->setStylesheetRoot(theStylesheet);
   
        if (theStylesheet == 0)
        {
  -             m_xsltProcessor.setExecutionContext(0);
  +             m_xsltProcessor->setExecutionContext(0);
        }
        else
        {
  -             m_xsltProcessor.setExecutionContext(this);
  +             m_xsltProcessor->setExecutionContext(this);
        }
   }
   
  @@ -235,14 +270,18 @@
   StylesheetExecutionContextDefault::resetCurrentState(
                        XalanNode*      xmlNode)
   {
  -     m_xsltProcessor.resetCurrentState(xmlNode);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->resetCurrentState(xmlNode);
   }
   
   
   bool
   StylesheetExecutionContextDefault::doDiagnosticsOutput() const
   {
  -     return m_xsltProcessor.doDiagnosticsOutput();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->doDiagnosticsOutput();
   }
   
   
  @@ -250,7 +289,9 @@
   void
   StylesheetExecutionContextDefault::diag(const XalanDOMString&        
theString)
   {
  -     m_xsltProcessor.diag(theString);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->diag(theString);
   }
   
   
  @@ -258,7 +299,9 @@
   void
   StylesheetExecutionContextDefault::pushTime(const void*      theKey)
   {
  -     m_xsltProcessor.pushTime(theKey);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->pushTime(theKey);
   }
   
   
  @@ -268,7 +311,9 @@
                        const XalanDOMString&   theMessage,
                        const void*                             theKey)
   {
  -     m_xsltProcessor.displayDuration(theMessage, theKey);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->displayDuration(theMessage, theKey);
   }
   
   
  @@ -276,7 +321,9 @@
   bool
   StylesheetExecutionContextDefault::isElementPending() const
   {
  -     return m_xsltProcessor.isElementPending();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->isElementPending();
   }
   
   
  @@ -287,9 +334,11 @@
                        const XalanDOMChar*             theNewType,
                        const XalanDOMChar*             theNewValue)
   {
  +     assert(m_xsltProcessor != 0);
  +
        // Remove the old attribute, then add the new one.  
AttributeListImpl::addAttribute()
        // does this for us.
  -     m_xsltProcessor.replacePendingAttribute(theName, theNewType, 
theNewValue);
  +     m_xsltProcessor->replacePendingAttribute(theName, theNewType, 
theNewValue);
   }
   
   
  @@ -297,7 +346,9 @@
   void
   StylesheetExecutionContextDefault::pushOutputContext(FormatterListener*      
        flistener)
   {
  -     m_xsltProcessor.pushOutputContext(flistener);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->pushOutputContext(flistener);
   }
   
   
  @@ -305,7 +356,9 @@
   void
   StylesheetExecutionContextDefault::popOutputContext()
   {
  -     m_xsltProcessor.popOutputContext();
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->popOutputContext();
   }
   
   
  @@ -315,7 +368,9 @@
                        const XalanDOMString&   aname,
                        const XalanDOMString&   value)
   {
  -     m_xsltProcessor.addResultAttribute(aname, value);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->addResultAttribute(aname, value);
   }
   
   
  @@ -323,7 +378,9 @@
   void
   StylesheetExecutionContextDefault::copyNamespaceAttributes(const XalanNode&  
        src)
   {
  -     m_xsltProcessor.copyNamespaceAttributes(src);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->copyNamespaceAttributes(src);
   }
   
   
  @@ -332,7 +389,9 @@
   StylesheetExecutionContextDefault::getResultPrefixForNamespace(
                        const XalanDOMString&   theNamespace) const
   {
  -     return m_xsltProcessor.getResultPrefixForNamespace(theNamespace);
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getResultPrefixForNamespace(theNamespace);
   }
   
   
  @@ -340,7 +399,9 @@
   const XalanDOMString&
   StylesheetExecutionContextDefault::getResultNamespaceForPrefix(const 
XalanDOMString& thePrefix) const
   {
  -     return m_xsltProcessor.getResultNamespaceForPrefix(thePrefix);
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getResultNamespaceForPrefix(thePrefix);
   }
   
   
  @@ -348,7 +409,9 @@
   XalanDOMString
   StylesheetExecutionContextDefault::getUniqueNamespaceValue() const
   {
  -     return m_xsltProcessor.getUniqueNamespaceValue();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getUniqueNamespaceValue();
   }
   
   
  @@ -356,7 +419,9 @@
   void
   StylesheetExecutionContextDefault::getUniqueNamespaceValue(XalanDOMString&   
theValue) const
   {
  -     m_xsltProcessor.getUniqueNamespaceValue(theValue);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->getUniqueNamespaceValue(theValue);
   }
   
   
  @@ -364,7 +429,9 @@
   FormatterListener*
   StylesheetExecutionContextDefault::getFormatterListener() const
   {
  -     return m_xsltProcessor.getFormatterListener();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getFormatterListener();
   }
   
   
  @@ -372,7 +439,9 @@
   void
   StylesheetExecutionContextDefault::setFormatterListener(FormatterListener*   
flistener)
   {
  -     m_xsltProcessor.setFormatterListener(flistener);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->setFormatterListener(flistener);
   }
   
   
  @@ -380,7 +449,9 @@
   int
   StylesheetExecutionContextDefault::getIndent() const
   {
  -     return m_xsltProcessor.getXMLParserLiaison().getIndent();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getXMLParserLiaison().getIndent();
   }
   
   
  @@ -391,7 +462,9 @@
                        XalanNode*                              contextNode,
                        const XalanElement&             resolver)
   {
  -     return m_xsltProcessor.evalXPathStr(str,
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->evalXPathStr(str,
                                                                                
contextNode,
                                                                                
resolver,
                                                                                
*this);
  @@ -404,6 +477,8 @@
                        const XalanDOMString&   str,
                        const PrefixResolver&   resolver)
   {
  +     assert(m_xsltProcessor != 0);
  +
        const XPath*    theResult = 0;
   
        // We won't cache any xpath that has a namespace, since
  @@ -419,7 +494,7 @@
        // try to cache the XPath...
        if (index < len - 1 && (charAt(str, index + 1) != 
XalanUnicode::charColon))
        {
  -             theResult = m_xsltProcessor.createMatchPattern(str, resolver);
  +             theResult = m_xsltProcessor->createMatchPattern(str, resolver);
        }
        else
        {
  @@ -435,7 +510,7 @@
                }
                else
                {
  -                     theResult = m_xsltProcessor.createMatchPattern(str, 
resolver);
  +                     theResult = m_xsltProcessor->createMatchPattern(str, 
resolver);
   
                        addToXPathCache(str, theResult);
                }
  @@ -449,9 +524,11 @@
   void
   StylesheetExecutionContextDefault::returnXPath(const XPath*          xpath)
   {
  +     assert(m_xsltProcessor != 0);
  +
        if (isCached(xpath) == false)
        {
  -             m_xsltProcessor.returnXPath(xpath);
  +             m_xsltProcessor->returnXPath(xpath);
        }
   }
   
  @@ -498,11 +575,13 @@
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver)
   {
  +     assert(m_xsltProcessor != 0);
  +
        if (length(str) > 0)
        {
                m_variablesStack.pushVariable(
                        name,
  -                     m_xsltProcessor.evalXPathStr(
  +                     m_xsltProcessor->evalXPathStr(
                                                        str,
                                                        contextNode,
                                                        resolver,
  @@ -580,8 +659,10 @@
   StylesheetExecutionContextDefault::resolveTopLevelParams()
   {
        pushContextMarker();
  +
  +     assert(m_xsltProcessor != 0);
   
  -     m_xsltProcessor.resolveTopLevelParams(*this);
  +     m_xsltProcessor->resolveTopLevelParams(*this);
   
        m_variablesStack.markGlobalStackFrame();
   }
  @@ -591,7 +672,9 @@
   void
   StylesheetExecutionContextDefault::clearTopLevelParams()
   {
  -     m_xsltProcessor.clearTopLevelParams();
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->clearTopLevelParams();
   }
   
   
  @@ -707,7 +790,9 @@
   void
   StylesheetExecutionContextDefault::startDocument()
   {
  -     m_xsltProcessor.startDocument();
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->startDocument();
   }
   
   
  @@ -715,8 +800,10 @@
   void
   StylesheetExecutionContextDefault::endDocument()
   {
  -     m_xsltProcessor.endDocument();
  +     assert(m_xsltProcessor != 0);
   
  +     m_xsltProcessor->endDocument();
  +
        // This matches the pushContextMarker in
        // resolveTopLevelParams().
        popContextMarker();
  @@ -734,7 +821,9 @@
                        unsigned int                    start,
                        unsigned int                    length)
   {
  -     m_xsltProcessor.characters(ch, start, length);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->characters(ch, start, length);
   }
   
   
  @@ -745,7 +834,9 @@
                        unsigned int                    start,
                        unsigned int                    length)
   {
  -     m_xsltProcessor.charactersRaw(ch, start, length);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->charactersRaw(ch, start, length);
   }
   
   
  @@ -753,7 +844,9 @@
   void
   StylesheetExecutionContextDefault::comment(const XalanDOMChar*       data)
   {
  -     m_xsltProcessor.comment(data);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->comment(data);
   }
   
   
  @@ -763,7 +856,9 @@
                        const XalanDOMChar*             target,
                        const XalanDOMChar*             data)
   {
  -     m_xsltProcessor.processingInstruction(target, data);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->processingInstruction(target, data);
   }
   
   
  @@ -771,7 +866,9 @@
   void
   StylesheetExecutionContextDefault::startElement(const XalanDOMChar*          
name)
   {
  -     m_xsltProcessor.startElement(name);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->startElement(name);
   }
   
   
  @@ -779,7 +876,9 @@
   void
   StylesheetExecutionContextDefault::endElement(const XalanDOMChar*    name)
   {
  -     m_xsltProcessor.endElement(name);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->endElement(name);
   }
   
   
  @@ -787,7 +886,9 @@
   void
   StylesheetExecutionContextDefault::flushPending()
   {
  -     m_xsltProcessor.flushPending();
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->flushPending();
   }
   
   
  @@ -799,7 +900,9 @@
                        bool            overrideStrip,
                        bool            shouldCloneAttributes)
   {
  -     m_xsltProcessor.cloneToResultTree(node,
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->cloneToResultTree(node,
                                                                          
isLiteral,
                                                                          
overrideStrip,
                                                                          
shouldCloneAttributes);
  @@ -812,18 +915,20 @@
                        const ElemTemplateElement&      templateChild,
                        XalanNode*                                      
sourceNode)
   {
  +     assert(m_xsltProcessor != 0);
  +
        BorrowReturnResultTreeFrag      theResultTreeFrag(*this);
   
        if (m_useDOMResultTreeFactory == true)
        {
  -             XalanDocument* const    theDocument = 
m_xsltProcessor.getDOMFactory();
  +             XalanDocument* const    theDocument = 
m_xsltProcessor->getDOMFactory();
   
                FormatterToDOM  tempFormatter(
                                        theDocument,
                                        theResultTreeFrag.get(),
                                        0);
   
  -             tempFormatter.setPrefixResolver(&m_xsltProcessor);
  +             tempFormatter.setPrefixResolver(m_xsltProcessor);
   
                theResultTreeFrag->setOwnerDocument(theDocument);
   
  @@ -841,7 +946,7 @@
                                        theDocument,
                                        theResultTreeFrag.get());
   
  -             tempFormatter.setPrefixResolver(&m_xsltProcessor);
  +             tempFormatter.setPrefixResolver(m_xsltProcessor);
   
                theResultTreeFrag->setOwnerDocument(theDocument);
   
  @@ -860,7 +965,9 @@
   void
   StylesheetExecutionContextDefault::outputToResultTree(const XObject& xobj)
   {
  -     m_xsltProcessor.outputToResultTree(*this, xobj);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->outputToResultTree(*this, xobj);
   }
   
   
  @@ -868,7 +975,9 @@
   void
   StylesheetExecutionContextDefault::outputResultTreeFragment(const XObject&   
theTree)
   {
  -     m_xsltProcessor.outputResultTreeFragment(*this, theTree);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->outputResultTreeFragment(*this, theTree);
   }
   
   
  @@ -876,7 +985,9 @@
   const XalanDOMString&
   StylesheetExecutionContextDefault::getXSLNameSpaceURL() const
   {
  -     return m_xsltProcessor.getXSLNameSpaceURL();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getXSLNameSpaceURL();
   }
   
   
  @@ -884,7 +995,9 @@
   const XalanDOMString&
   StylesheetExecutionContextDefault::getXalanXSLNameSpaceURL() const
   {
  -     return m_xsltProcessor.getXalanXSLNameSpaceURL();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getXalanXSLNameSpaceURL();
   }
   
   
  @@ -892,7 +1005,9 @@
   bool
   StylesheetExecutionContextDefault::getTraceSelects() const
   {
  -     return m_xsltProcessor.getTraceSelects();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getTraceSelects();
   }
   
   
  @@ -902,7 +1017,9 @@
                        const XalanElement&             theTemplate,
                        const NodeRefListBase&  nl) const
   {
  -     m_xsltProcessor.traceSelect(theTemplate, nl);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->traceSelect(theTemplate, nl);
   }
   
   
  @@ -1020,7 +1137,7 @@
        if (m_ignoreHTMLElementNamespaces == false)
        {
                // Nope, so give the formatter a prefix resolver...
  -             theFormatter->setPrefixResolver(&m_xsltProcessor);
  +             theFormatter->setPrefixResolver(m_xsltProcessor);
        }
   
        m_formatterListeners.insert(theFormatter);
  @@ -1044,7 +1161,7 @@
   
        m_formatterListeners.insert(theFormatter);
   
  -     theFormatter->setPrefixResolver(&m_xsltProcessor);
  +     theFormatter->setPrefixResolver(m_xsltProcessor);
   
        return theFormatter;
   }
  @@ -1063,7 +1180,7 @@
   
        m_formatterListeners.insert(theFormatter);
   
  -     theFormatter->setPrefixResolver(&m_xsltProcessor);
  +     theFormatter->setPrefixResolver(m_xsltProcessor);
   
        return theFormatter;
   }
  @@ -1152,6 +1269,24 @@
   
   int
   StylesheetExecutionContextDefault::collationCompare(
  +                     const XalanDOMString&   theLHS,
  +                     const XalanDOMString&   theRHS,
  +                     const XalanDOMString&   theLocale)
  +{
  +     if (m_collationCompareFunctor == 0)
  +     {
  +             return s_defaultCollationFunctor(c_wstr(theLHS), 
c_wstr(theRHS), c_wstr(theLocale));
  +     }
  +     else
  +     {
  +             return (*m_collationCompareFunctor)(c_wstr(theLHS), 
c_wstr(theRHS), c_wstr(theLocale));
  +     }
  +}
  +
  +
  +
  +int
  +StylesheetExecutionContextDefault::collationCompare(
                        const XalanDOMChar*             theLHS,
                        const XalanDOMChar*             theRHS)
   {
  @@ -1169,6 +1304,26 @@
   
   
   
  +int
  +StylesheetExecutionContextDefault::collationCompare(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             theLocale)
  +{
  +     assert(theLHS != 0 && theRHS != 0);
  +
  +     if (m_collationCompareFunctor == 0)
  +     {
  +             return s_defaultCollationFunctor(theLHS, theRHS, theLocale);
  +     }
  +     else
  +     {
  +             return (*m_collationCompareFunctor)(theLHS, theRHS, theLocale);
  +     }
  +}
  +
  +
  +
   
StylesheetExecutionContextDefault::CollationCompareFunctor::CollationCompareFunctor()
   {
   }
  @@ -1213,6 +1368,17 @@
   
   
   
  +int
  
+StylesheetExecutionContextDefault::DefaultCollationCompareFunctor::operator()(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             /* theLocale */) const
  +{
  +     return (*this)(theLHS, theRHS);
  +}
  +
  +
  +
   StylesheetExecutionContextDefault::CollationCompareFunctor*
   
StylesheetExecutionContextDefault::installCollationCompareFunctor(CollationCompareFunctor*
   theFunctor)
   {
  @@ -1258,7 +1424,10 @@
   
        m_variablesStack.reset();
   
  -     m_xsltProcessor.reset();
  +     if (m_xsltProcessor != 0)
  +     {
  +             m_xsltProcessor->reset();
  +     }
   
        m_mode = 0;
   
  @@ -1387,24 +1556,6 @@
   
   
   
  -XLocator*
  -StylesheetExecutionContextDefault::getXLocatorFromNode(const XalanNode*      
        node) const
  -{
  -     return m_xpathExecutionContextDefault.getXLocatorFromNode(node);
  -}
  -
  -
  -
  -void
  -StylesheetExecutionContextDefault::associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator)
  -{
  -     m_xpathExecutionContextDefault.associateXLocatorToNode(node, xlocator);
  -}
  -
  -
  -
   XalanDocument*
   StylesheetExecutionContextDefault::parseXML(
                        const XalanDOMString&   urlString,
  @@ -1673,7 +1824,9 @@
   unsigned long
   StylesheetExecutionContextDefault::getTraceListeners() const
   {
  -     return m_xsltProcessor.getTraceListeners();
  +     assert(m_xsltProcessor != 0);
  +
  +     return m_xsltProcessor->getTraceListeners();
   }
   
   
  @@ -1681,7 +1834,9 @@
   void
   StylesheetExecutionContextDefault::fireGenerateEvent(const GenerateEvent&    
ge)
   {
  -     m_xsltProcessor.fireGenerateEvent(ge);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->fireGenerateEvent(ge);
   }
   
   
  @@ -1689,7 +1844,9 @@
   void
   StylesheetExecutionContextDefault::fireTraceEvent(const TracerEvent& te)
   {
  -     m_xsltProcessor.fireTraceEvent(te);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->fireTraceEvent(te);
   }
   
   
  @@ -1697,7 +1854,9 @@
   void
   StylesheetExecutionContextDefault::fireSelectEvent(const SelectionEvent&     
se)
   {
  -     m_xsltProcessor.fireSelectEvent(se);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->fireSelectEvent(se);
   }
   
   
  @@ -1708,7 +1867,9 @@
                        const XalanNode*                sourceNode,
                        const XalanNode*                styleNode) const
   {
  -     m_xsltProcessor.error(msg, sourceNode, styleNode);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->error(msg, sourceNode, styleNode);
   }
   
   
  @@ -1730,7 +1891,9 @@
                        const XalanNode*                sourceNode,
                        const XalanNode*                styleNode) const
   {
  -     m_xsltProcessor.warn(msg, sourceNode, styleNode);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->warn(msg, sourceNode, styleNode);
   }
   
   
  @@ -1752,7 +1915,9 @@
                        const XalanNode*                sourceNode,
                        const XalanNode*                styleNode) const
   {
  -     m_xsltProcessor.message(msg, sourceNode, styleNode);
  +     assert(m_xsltProcessor != 0);
  +
  +     m_xsltProcessor->message(msg, sourceNode, styleNode);
   }
   
   
  @@ -1888,10 +2053,15 @@
        using std::for_each;
   #endif
   
  -     for_each(m_matchPatternCache.begin(),
  -                      m_matchPatternCache.end(),
  -                      XPathCacheReturnFunctor(m_xsltProcessor));
  +     assert(m_matchPatternCache.size() == 0 || m_xsltProcessor != 0);
   
  +     if (m_xsltProcessor != 0)
  +     {
  +             for_each(m_matchPatternCache.begin(),
  +                              m_matchPatternCache.end(),
  +                              XPathCacheReturnFunctor(*m_xsltProcessor));
  +     }
  +
        m_matchPatternCache.clear();
   }
   
  @@ -1902,6 +2072,8 @@
                        const XalanDOMString&   pattern,
                        const XPath*                    theXPath)
   {
  +     assert(m_xsltProcessor != 0);
  +
        clock_t         addClock = clock();
   
        if (m_matchPatternCache.size() == eXPathCacheMax)
  @@ -1941,7 +2113,7 @@
                assert(earliest != theEnd);
   
                // Return the XPath and erase it from the cache.
  -             m_xsltProcessor.returnXPath((*earliest).second.first);
  +             m_xsltProcessor->returnXPath((*earliest).second.first);
   
                m_matchPatternCache.erase(earliest);
        }
  
  
  
  1.53      +89 -9     
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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- StylesheetExecutionContextDefault.hpp     2001/03/11 16:47:52     1.52
  +++ StylesheetExecutionContextDefault.hpp     2001/03/29 22:24:26     1.53
  @@ -151,6 +151,22 @@
                        const NodeRefListBase*  theContextNodeList = 0,
                        const PrefixResolver*   thePrefixResolver = 0);
   
  +     /**
  +      * Construct a StylesheetExecutionContextDefault object
  +      *
  +      * @param theXPathEnvSupport XPath environment support class instance
  +      * @param theDOMSupport          DOMSupport class instance
  +      * @param theXobjectFactory  factory class instance for XObjects
  +      * @param theCurrentNode     current node in the source tree
  +      * @param theContextNodeList node list for current context
  +      * @param thePrefixResolver  pointer to prefix resolver to use
  +      */
  +     explicit
  +     StylesheetExecutionContextDefault(
  +                     XalanNode*                              theCurrentNode 
= 0,
  +                     const NodeRefListBase*  theContextNodeList = 0,
  +                     const PrefixResolver*   thePrefixResolver = 0);
  +
        virtual
        ~StylesheetExecutionContextDefault();
   
  @@ -207,6 +223,52 @@
                m_ignoreHTMLElementNamespaces = theValue;
        }
   
  +     /**
  +      * Set the XPathEnvSupport instance.
  +      *
  +      * @param theSupport a reference to the instance to use.
  +      */
  +     void
  +     setXPathEnvSupport(XPathEnvSupport*             theSupport)
  +     {
  +             m_xpathExecutionContextDefault.setXPathEnvSupport(theSupport);
  +     }
  +
  +     /**
  +      * Set the XObjectFactory instance.
  +      *
  +      * @param theFactory a reference to the instance to use.
  +      */
  +     void
  +     setXObjectFactory(XObjectFactory*       theFactory)
  +     {
  +             m_xpathExecutionContextDefault.setXObjectFactory(theFactory);
  +     }
  +
  +     /**
  +      * Set the DOMSupport instance.
  +      *
  +      * @param theDOMSupport a reference to the instance to use.
  +      */
  +     void
  +     setDOMSupport(DOMSupport*       theDOMSupport)
  +     {
  +             m_xpathExecutionContextDefault.setDOMSupport(theDOMSupport);
  +     }
  +
  +
  +     /**
  +      * Set the DOMSupport instance.
  +      *
  +      * @param theDOMSupport a reference to the instance to use.
  +      */
  +     void
  +     setDOMSupport(XSLTEngineImpl&   theProcessor)
  +     {
  +             m_xsltProcessor = &theProcessor;
  +     }
  +
  +
        // These interfaces are inherited from StylesheetExecutionContext...
   
        virtual bool
  @@ -563,9 +625,21 @@
   
        virtual int
        collationCompare(
  +                     const XalanDOMString&   theLHS,
  +                     const XalanDOMString&   theRHS,
  +                     const XalanDOMString&   theLocale);
  +
  +     virtual int
  +     collationCompare(
                        const XalanDOMChar*             theLHS,
                        const XalanDOMChar*             theRHS);
   
  +     virtual int
  +     collationCompare(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             theLocale);
  +
        class XALAN_XSLT_EXPORT CollationCompareFunctor
        {
        public:
  @@ -588,6 +662,14 @@
                operator()(
                        const XalanDOMChar*             theLHS,
                        const XalanDOMChar*             theRHS) const = 0;
  +
  +             // Const version is suitable for use by
  +             // multiple threads.
  +             virtual int
  +             operator()(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             theLocale) const = 0;
        };
   
        class XALAN_XSLT_EXPORT DefaultCollationCompareFunctor : public 
CollationCompareFunctor
  @@ -608,6 +690,12 @@
                operator()(
                        const XalanDOMChar*             theLHS,
                        const XalanDOMChar*             theRHS) const;
  +
  +             virtual int
  +             operator()(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS,
  +                     const XalanDOMChar*             theLocale) const;
        };
   
        CollationCompareFunctor*
  @@ -694,14 +782,6 @@
                        XalanNode*                                              
context,
                        const XObjectArgVectorType&             argVec);
   
  -     virtual XLocator*
  -     getXLocatorFromNode(const XalanNode*    node) const;
  -
  -     virtual void
  -     associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator);
  -
        virtual XalanDocument*
        parseXML(
                        const XalanDOMString&   urlString,
  @@ -893,7 +973,7 @@
        XPathExecutionContextDefault    m_xpathExecutionContextDefault;
   
        // $$ ToDo: Try to remove this dependency, and rely only on 
XSLTProcessor...
  -     XSLTEngineImpl&                                 m_xsltProcessor;
  +     XSLTEngineImpl*                                 m_xsltProcessor;
   
        XalanNode*                                              m_rootDocument;
   
  
  
  
  1.61      +21 -10    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.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- StylesheetHandler.cpp     2001/02/20 17:17:18     1.60
  +++ StylesheetHandler.cpp     2001/03/29 22:24:26     1.61
  @@ -503,7 +503,8 @@
                                                        ElemTemplateElement* 
const      lastChild = parent->getLastChildElem();
   
                                                        if(0 == lastChild ||
  -                                                             
Constants::ELEMNAME_WHEN == lastChild->getXSLToken())
  +                                                             
Constants::ELEMNAME_WHEN == lastChild->getXSLToken() ||
  +                                                             
lastChild->isWhitespace() == true)
                                                        {
                                                                elem = new 
ElemWhen(m_constructionContext,
                                                                                
        m_stylesheet,
  @@ -529,8 +530,9 @@
                                                {
                                                        ElemTemplateElement* 
lastChild = parent->getLastChildElem();
   
  -                                                     if(0 == lastChild || 
  -                                                             
Constants::ELEMNAME_WHEN == lastChild->getXSLToken())
  +                                                     if(0 == lastChild ||
  +                                                             
Constants::ELEMNAME_WHEN == lastChild->getXSLToken() ||
  +                                                             
lastChild->isWhitespace() == true)
                                                        {
                                                                elem = new 
ElemOtherwise(m_constructionContext,
                                                                                
                 m_stylesheet,
  @@ -1716,7 +1718,8 @@
                        disableOutputEscaping = 
static_cast<ElemText*>(parent)->getDisableOutputEscaping();
   #endif
                        preserveSpace = true;
  -                     parent = m_elemStack[m_elemStack.size()-2];
  +
  +                     parent = m_elemStack[m_elemStack.size() - 2];
                }
   
                const Locator* const    locator = 
m_constructionContext.getLocatorFromStack();
  @@ -1724,14 +1727,14 @@
                const int       lineNumber = (0 != locator) ? 
locator->getLineNumber() : 0;
                const int       columnNumber = (0 != locator) ? 
locator->getColumnNumber() : 0;
   
  -             ElemTextLiteral* const  elem = new 
ElemTextLiteral(m_constructionContext,
  +             XalanAutoPtr<ElemTextLiteral>   elem(new 
ElemTextLiteral(m_constructionContext,
                        m_stylesheet,
                        lineNumber, columnNumber,
                        chars, 0, length,
                        true, preserveSpace, 
  -                     disableOutputEscaping);
  +                     disableOutputEscaping));
   
  -             const bool      isWhite = isXMLWhitespace(chars, 0, length);
  +             const bool      isWhite = elem->isWhitespace();
   
                if(preserveSpace || (!preserveSpace && !isWhite))
                {
  @@ -1741,8 +1744,10 @@
   
                                m_whiteSpaceElems.pop_back();
                        }
  +
  +                     parent->appendChildElem(elem.get());
   
  -                     parent->appendChildElem(elem);
  +                     elem.release();
                }
                else if(isWhite)
                {
  @@ -1761,14 +1766,20 @@
   
                                if(isPrevCharData && ! isLastPoppedXSLText)
                                {
  -                                     parent->appendChildElem(elem);
  +                                     parent->appendChildElem(elem.get());
  +
  +                                     elem.release();
   
                                        shouldPush = false;
                                }
                        }
   
                        if(shouldPush)
  -                             m_whiteSpaceElems.push_back(elem);
  +                     {
  +                             m_whiteSpaceElems.push_back(elem.get());
  +
  +                             elem.release();
  +                     }
                }
        }
        else if (m_inLXSLTScript)
  
  
  
  1.40      +4 -0      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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- StylesheetRoot.cpp        2001/03/09 16:19:55     1.39
  +++ StylesheetRoot.cpp        2001/03/29 22:24:26     1.40
  @@ -227,6 +227,10 @@
        // why
        //executionContext.setCurrentNode(sourceTree);
   
  +     const QNameByValue      theDefaultMode;
  +
  +     executionContext.setCurrentMode(&theDefaultMode);
  +
        XPathExecutionContext::CurrentNodeSetAndRestore 
theCurrentNodeSetAndRestore(executionContext, sourceTree);
   
        // Output the action of the found root rule.  All processing
  
  
  
  1.94      +57 -64    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.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- XSLTEngineImpl.cpp        2001/03/05 17:27:38     1.93
  +++ XSLTEngineImpl.cpp        2001/03/29 22:24:26     1.94
  @@ -242,6 +242,9 @@
   
   
   
  +static const XalanDOMChar    s_dummyString = 0;
  +
  +
   void
   XSLTEngineImpl::process(
                        const XSLTInputSource&                  inputSource, 
  @@ -360,23 +363,34 @@
   
                        bool isRoot = true;
                        Stylesheet* prevStylesheet = 0;
  -                     while(!hrefs.empty())
  +                     
  +                     if (hrefs.empty() == false)
                        {
  -                             const XalanDOMChar* const               pxch = 
inputSource.getSystemId();
  -                             const XalanDOMString    sysid(pxch);
  -                             const XalanDOMString&   ref =  hrefs.back();
  +                             const XalanDOMChar* const       pxch = 
inputSource.getSystemId();
   
  -                             Stylesheet* stylesheet =
  -                                     getStylesheetFromPIURL(ref, 
*sourceTree, sysid, isRoot, constructionContext);
  +                             const XalanDOMString            sysid(pxch == 0 
? &s_dummyString : pxch); 
   
  -                             if(false == isRoot)
  +                             do
                                {
  -                                     prevStylesheet->addImport(stylesheet, 
false);
  -                             }
  +                                     const XalanDOMString&   ref =  
hrefs.back();
   
  -                             prevStylesheet = stylesheet;
  -                             isRoot = false;
  -                             hrefs.pop_back();
  +                                     Stylesheet* stylesheet =
  +                                                     getStylesheetFromPIURL(
  +                                                             ref,
  +                                                             *sourceTree,
  +                                                             sysid,
  +                                                             isRoot,
  +                                                             
constructionContext);
  +
  +                                     if(false == isRoot)
  +                                     {
  +                                             
prevStylesheet->addImport(stylesheet, false);
  +                                     }
  +
  +                                     prevStylesheet = stylesheet;
  +                                     isRoot = false;
  +                                     hrefs.pop_back();
  +                             } while(!hrefs.empty());
                        }
                }
   
  @@ -1970,14 +1984,14 @@
                        bool                            overrideStrip,
                        bool                            shouldCloneAttributes)
   {
  -     bool                                            stripWhiteSpace = false;
  -
        const XalanNode::NodeType       theType = node.getNodeType();
   
        switch(theType)
        {
        case XalanNode::TEXT_NODE:
                {
  +                     bool    stripWhiteSpace = false;
  +
                        // If stripWhiteSpace is false, then take this as an 
override and 
                        // just preserve the space, otherwise use the XSL 
whitespace rules.
                        if(!overrideStrip)
  @@ -2511,20 +2525,22 @@
                        AttributeListImpl&              attrList, 
                        const XalanElement&     /* namespaceContext */)
   {
  -     const XalanDOMString    attrName = trim(attr.getName());
  +     const XalanDOMString&   attrName = attr.getName();
   
  -     XalanDOMString                  stringedValue = attr.getValue();
  +     const XalanDOMString&   attrValue = attr.getValue();
   
        // TODO: Find out about empty attribute template expression handling.
  -     if(0 != length(stringedValue))
  +     if(0 != length(attrValue))
        {
                if((equals(attrName, DOMServices::s_XMLNamespace) || 
startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator))
  -                && startsWith(stringedValue, 
XALAN_STATIC_UCODE_STRING("quote:")))
  +                && startsWith(attrValue, 
XALAN_STATIC_UCODE_STRING("quote:")))
                {
  -                     stringedValue = substring(stringedValue, 6);
  +                     addResultAttribute(attrList, attrName, 
substring(attrValue, 6));
                }
  -
  -             addResultAttribute(attrList, attrName, stringedValue);
  +             else
  +             {
  +                     addResultAttribute(attrList, attrName, attrValue);
  +             }
        }
   }
   
  @@ -2543,29 +2559,32 @@
        const XalanNamedNodeMap* const  attributes =
                templateChild.getAttributes();
   
  -     const unsigned int      nAttributes = (0 != attributes) ? 
attributes->getLength() : 0;
  +     if (attributes != 0)
  +     {
  +             const unsigned int      nAttributes = attributes->getLength();
   
  -     for(unsigned int        i = 0; i < nAttributes; i++)  
  -     {       
  -             const XalanAttr* const  attr =
  +             for(unsigned int i = 0; i < nAttributes; ++i)  
  +             {       
  +                     const XalanAttr* const  attr =
   #if defined(XALAN_OLD_STYLE_CASTS)
  -                     (const XalanAttr*)attributes->item(i);
  +                             (const XalanAttr*)attributes->item(i);
   #else
  -                     static_cast<const XalanAttr*>(attributes->item(i));
  +                             static_cast<const 
XalanAttr*>(attributes->item(i));
   #endif
  -             assert(attr != 0);
  +                     assert(attr != 0);
   
  -             copyAttributeToTarget(
  -                             *attr,
  -                             contextNode,
  -                             stylesheetTree, 
  -                             attList,
  -                             templateChild);
  +                     copyAttributeToTarget(
  +                                     *attr,
  +                                     contextNode,
  +                                     stylesheetTree, 
  +                                     attList,
  +                                     templateChild);
  +             }
        }
   }
   
  +
   
  - 
   bool
   XSLTEngineImpl::shouldStripSourceNode(
                        XPathExecutionContext&  executionContext,
  @@ -2709,7 +2728,7 @@
   
   
   const XalanDOMString
  -XSLTEngineImpl::getUniqueNamespaceValue() const
  +XSLTEngineImpl::getUniqueNamespaceValue()
   {
        XalanDOMString  theResult;
   
  @@ -2721,19 +2740,11 @@
   
   
   void
  -XSLTEngineImpl::getUniqueNamespaceValue(XalanDOMString&              
theValue) const
  +XSLTEngineImpl::getUniqueNamespaceValue(XalanDOMString&              
theValue)
   {
  -     const unsigned long             temp = m_uniqueNSValue;
  -
  -#if defined(XALAN_NO_MUTABLE)
  -     ((XSLTEngineImpl*)this)->m_uniqueNSValue++;
  -#else
  -     m_uniqueNSValue++;
  -#endif
  -
        append(theValue, s_uniqueNamespacePrefix);
   
  -     UnsignedLongToDOMString(temp, theValue);
  +     UnsignedLongToDOMString(m_uniqueNSValue++, theValue);
   }
   
   
  @@ -2751,24 +2762,6 @@
        }
   
        return m_domResultTreeFactory;
  -}
  -
  -
  -
  -XLocator*
  -XSLTEngineImpl::getXLocatorFromNode(const XalanNode* node) const
  -{
  -     return m_xpathEnvSupport.getXLocatorFromNode(node);
  -}
  -     
  -
  -
  -void
  -XSLTEngineImpl::associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator)
  -{
  -     m_xpathEnvSupport.associateXLocatorToNode(node, xlocator);
   }
   
   
  
  
  
  1.64      +3 -25     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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- XSLTEngineImpl.hpp        2001/03/02 15:36:49     1.63
  +++ XSLTEngineImpl.hpp        2001/03/29 22:24:27     1.64
  @@ -265,10 +265,10 @@
        getXMLParserLiaison() const;
   
        virtual const XalanDOMString
  -     getUniqueNamespaceValue() const;
  +     getUniqueNamespaceValue();
   
        virtual void
  -     getUniqueNamespaceValue(XalanDOMString&         theValue) const;
  +     getUniqueNamespaceValue(XalanDOMString&         theValue);
   
        virtual void
        setStylesheetParam(     
  @@ -1590,30 +1590,8 @@
        /**
         * This is used whenever a unique namespace is needed.
         */
  -     mutable unsigned long   m_uniqueNSValue;        // 0
  +     unsigned long   m_uniqueNSValue;
     
  -
  -     /**
  -      * Get an XLocator provider keyed by node.      This gets the 
association
  -      * based on the root of the tree that is the node's parent.
  -      *
  -      * @param node node for locator
  -      * @return pointer to locator
  -      */
  -     XLocator*
  -     getXLocatorFromNode(const XalanNode*    node) const;
  -
  -     /**
  -      * Associate an XLocator provider to a node.  This makes the association
  -      * based on the root of the tree that is the node's parent.
  -      *
  -      * @param node     node for association
  -      * @param xlocator locator to associate with node
  -      */
  -      void
  -      associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator);
   
        /**
         * Control if the xsl:variable is resolved early or 
  
  
  
  1.21      +2 -2      xml-xalan/c/src/XSLT/XSLTProcessor.hpp
  
  Index: XSLTProcessor.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessor.hpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XSLTProcessor.hpp 2001/03/02 15:36:52     1.20
  +++ XSLTProcessor.hpp 2001/03/29 22:24:27     1.21
  @@ -273,7 +273,7 @@
         * @return unique namespace prefix
         */
        virtual const XalanDOMString
  -     getUniqueNamespaceValue() const = 0;
  +     getUniqueNamespaceValue() = 0;
   
        /**
         * Generate a random namespace prefix guaranteed to be unique.
  @@ -281,7 +281,7 @@
         * @param theValue A string for returning the new prefix
         */
        virtual void
  -     getUniqueNamespaceValue(XalanDOMString&         theValue) const = 0;
  +     getUniqueNamespaceValue(XalanDOMString&         theValue) = 0;
   
      /**
        * Push a top-level stylesheet parameter.  This value can be evaluated 
via
  
  
  
  1.9       +0 -8      xml-xalan/c/src/XSLT/XSLTProcessorEnvSupport.hpp
  
  Index: XSLTProcessorEnvSupport.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupport.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSLTProcessorEnvSupport.hpp       2000/11/21 21:10:27     1.8
  +++ XSLTProcessorEnvSupport.hpp       2001/03/29 22:24:27     1.9
  @@ -124,14 +124,6 @@
                        XalanNode*                                              
context,
                        const XObjectArgVectorType&             argVec) const = 
0;
   
  -     virtual XLocator*
  -     getXLocatorFromNode(const XalanNode*    node) const = 0;
  -
  -     virtual void
  -     associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator) = 0;
  -
        virtual bool
        shouldStripSourceNode(
                        XPathExecutionContext&  executionContext,
  
  
  
  1.20      +1 -32     xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp
  
  Index: XSLTProcessorEnvSupportDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XSLTProcessorEnvSupportDefault.cpp        2001/02/03 00:08:07     1.19
  +++ XSLTProcessorEnvSupportDefault.cpp        2001/03/29 22:24:27     1.20
  @@ -93,8 +93,7 @@
   
XSLTProcessorEnvSupportDefault::XSLTProcessorEnvSupportDefault(XSLTProcessor*   
     theProcessor) :
        XSLTProcessorEnvSupport(),
        m_defaultSupport(),
  -     m_processor(theProcessor),
  -     m_xlocatorTable()
  +     m_processor(theProcessor)
   {
   }
   
  @@ -157,8 +156,6 @@
   #endif
   
        m_defaultSupport.reset();
  -
  -     m_xlocatorTable.clear();
   }
   
   
  @@ -285,34 +282,6 @@
                                                                                
functionName,
                                                                                
context,
                                                                                
argVec);
  -}
  -
  -
  -
  -XLocator*
  -XSLTProcessorEnvSupportDefault::getXLocatorFromNode(const XalanNode* node) 
const
  -{
  -     const XLocatorTableType::const_iterator         i =
  -                                     m_xlocatorTable.find(node);
  -
  -     if (i == m_xlocatorTable.end())
  -     {
  -             return 0;
  -     }
  -     else
  -     {
  -             return (*i).second;
  -     }
  -}
  -
  -
  -
  -void
  -XSLTProcessorEnvSupportDefault::associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator)
  -{
  -     m_xlocatorTable[node] = xlocator;
   }
   
   
  
  
  
  1.16      +0 -23     xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp
  
  Index: XSLTProcessorEnvSupportDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XSLTProcessorEnvSupportDefault.hpp        2000/11/21 21:10:29     1.15
  +++ XSLTProcessorEnvSupportDefault.hpp        2001/03/29 22:24:27     1.16
  @@ -66,10 +66,6 @@
   
   
   
  -#include <map>
  -
  -
  -
   // Base class header file...
   #include <XSLT/XSLTProcessorEnvSupport.hpp>
   
  @@ -193,14 +189,6 @@
                        XalanNode*                                              
context,
                        const XObjectArgVectorType&             argVec) const;
   
  -     virtual XLocator*
  -     getXLocatorFromNode(const XalanNode*    node) const;
  -
  -     virtual void
  -     associateXLocatorToNode(
  -                     const XalanNode*        node,
  -                     XLocator*                       xlocator);
  -
        virtual bool
        shouldStripSourceNode(
                        XPathExecutionContext&  executionContext,
  @@ -231,16 +219,7 @@
        virtual void
        reset();
   
  -#if defined(XALAN_NO_NAMESPACES)
  -     typedef map<const XalanNode*,
  -                             XLocator*,
  -                             less<const XalanNode*> >                        
XLocatorTableType;
  -#else
  -     typedef std::map<const XalanNode*, XLocator*>   XLocatorTableType;
  -#endif
   
  -private:
  -
        // These are not implemented...
        XSLTProcessorEnvSupportDefault(const XSLTProcessorEnvSupportDefault&);
   
  @@ -256,8 +235,6 @@
        XPathEnvSupportDefault          m_defaultSupport;
   
        XSLTProcessor*                          m_processor;
  -
  -     XLocatorTableType                       m_xlocatorTable;
   };
   
   
  
  
  

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

Reply via email to