dbertoni    2002/09/25 18:37:47

  Modified:    c/src/XSLT KeyTable.cpp KeyTable.hpp
  Log:
  Make sure node sets are marked being in document order.
  
  Revision  Changes    Path
  1.20      +39 -9     xml-xalan/c/src/XSLT/KeyTable.cpp
  
  Index: KeyTable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- KeyTable.cpp      21 Sep 2002 01:24:41 -0000      1.19
  +++ KeyTable.cpp      26 Sep 2002 01:37:47 -0000      1.20
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -203,6 +203,36 @@
   
                pos = nextNode;
       } // while(0 != pos)
  +
  +     if (m_keys.empty() == false)
  +     {
  +             const KeysMapType::iterator             theEnd = m_keys.end();
  +             KeysMapType::iterator                   theCurrent = 
m_keys.begin();
  +             assert(theCurrent != theEnd);
  +
  +             do
  +             {
  +                     NodeListMapType&        theCurrentNodeListMap = 
(*theCurrent).second;
  +
  +                     if (theCurrentNodeListMap.empty() == false)
  +                     {
  +                             const NodeListMapType::iterator         theEnd 
= theCurrentNodeListMap.end();
  +                             NodeListMapType::iterator                       
theCurrent = theCurrentNodeListMap.begin();
  +                             assert(theCurrent != theEnd);
  +
  +                             do
  +                             {
  +                                     (*theCurrent).second.setDocumentOrder();
  +
  +                                     ++theCurrent;
  +                             }
  +                             while(theCurrent != theEnd);
  +                     }
  +
  +                     ++theCurrent;
  +             }
  +             while(theCurrent != theEnd);
  +     }       
   } // end constructor
   
   
  @@ -213,7 +243,7 @@
   
   
   
  -const NodeRefListBase&
  +const MutableNodeRefList&
   KeyTable::getNodeSetByKey(
                                          const XalanQName&                     
qname, 
                                          const XalanDOMString&         ref) 
const
  @@ -241,14 +271,12 @@
   
   
   inline void
  -KeyTable::addIfNotFound(
  -                     MutableNodeRefList&             theNodeList,
  -                     XalanNode*                              theNode)
  +addIfNotFound(
  +                     StylesheetExecutionContext&             
executionContext,
  +                     MutableNodeRefList&                             
theNodeList,
  +                     XalanNode*                                              
theNode)
   {
  -     if (theNodeList.indexOf(theNode) == MutableNodeRefList::npos)
  -     {
  -             theNodeList.addNode(theNode);
  -     }
  +     theNodeList.addNodeInDocOrder(theNode, executionContext);
   }
   
   
  @@ -270,6 +298,7 @@
        if(xuse->getType() != XObject::eTypeNodeSet)
        {
                addIfNotFound(
  +                     executionContext,
                        theKeys[kd.getQName()][xuse->str()],
                        testNode);
        }
  @@ -296,6 +325,7 @@
                        DOMServices::getNodeData(*nl.item(i), nodeData);
   
                        addIfNotFound(
  +                             executionContext,
                                theKeys[kd.getQName()][nodeData],
                                testNode);
   
  
  
  
  1.14      +3 -14     xml-xalan/c/src/XSLT/KeyTable.hpp
  
  Index: KeyTable.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- KeyTable.hpp      21 Sep 2002 01:24:41 -0000      1.13
  +++ KeyTable.hpp      26 Sep 2002 01:37:47 -0000      1.14
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -157,23 +157,12 @@
         *             attribute on xsl:key
         * @return              pointer to nodeset for key 
         */
  -     const NodeRefListBase&
  +     const MutableNodeRefList&
        getNodeSetByKey(
                                  const XalanQName&                     qname,
                                  const XalanDOMString&         ref) const;
   
   private:
  -
  -     /**
  -      * Helper function to add a node to the list if not found.
  -      * 
  -      * @param theNodeList the node list.
  -      * @param theNode the node to add.
  -      */
  -     static void
  -     addIfNotFound(
  -                     MutableNodeRefList&             theNodeList,
  -                     XalanNode*                              theNode);
   
        static void
        processKeyDeclaration(
  
  
  

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

Reply via email to