You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/02/22 05:36:09 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt KeyTable.java

sboag       00/02/21 20:36:09

  Modified:    src/org/apache/xalan/xslt KeyTable.java
  Log:
  Added Myriam's fixes for recursive xsl:key control for Xerces liaison... it is likely that we should back out of the code split between DTM and Xerces DOM, but we need to do perf measurements.  Myriam needs to review.
  
  Revision  Changes    Path
  1.9       +23 -1     xml-xalan/src/org/apache/xalan/xslt/KeyTable.java
  
  Index: KeyTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/KeyTable.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- KeyTable.java	2000/01/31 08:03:41	1.8
  +++ KeyTable.java	2000/02/22 04:36:09	1.9
  @@ -287,12 +287,26 @@
             {
               KeyDeclaration kd = (KeyDeclaration)keyDeclarations.elementAt(i);
               
  +            if(!kd.m_name.equals(name)) 
  +              continue;
  +            // We are currently processing this key declaration.
  +            // More than likely, the key function was called in the 
  +            // xsl:key declaration using the same key name.
  +            if( kd.m_buildState == KeyDeclaration.BUILDING)
  +            {
  +              return;
  +              // break;
  +            }  
  +            kd.m_buildState = KeyDeclaration.BUILDING;
  +            
               // See if our node matches the given key declaration according to 
               // the match attribute on xsl:key.
               double score = kd.m_match.getMatchScore(execContext, testNode);
               if(score == kd.m_match.MATCH_SCORE_NONE)
  +            {
  +              kd.m_buildState = KeyDeclaration.BUILT;
                 continue;
  -
  +            } 
               // Query from the node, according the the select pattern in the
               // use attribute in xsl:key.
               XObject xuse = kd.m_use.execute(execContext, testNode, nscontext);
  @@ -309,7 +323,10 @@
               {
                 nl = xuse.nodeset();
                 if(0 == nl.getLength())
  +              {  
  +                kd.m_buildState = KeyDeclaration.BUILT;
                   continue;
  +              }  
                 
                 // Use each node in the node list as a key value that we'll be 
                 // able to use to look up the given node.
  @@ -379,6 +396,10 @@
                   keyNodes.addElement(testNode);
                 }
               } // end for(int k = 0; k < nUseValues; k++)
  +            
  +            kd.m_buildState = KeyDeclaration.BUILT;
  +            break;
  +
             } // end for(int i = 0; i < nDeclarations; i++)
             nodeIndex++;
             if(null != attrs)
  @@ -422,6 +443,7 @@
           m_keys.put(kd.m_name, namedKeyTable);
         }
       }
  +              
     } // end buildKeysTable method
       
     /**