sboag       00/06/21 21:43:17

  Modified:    src/org/apache/xalan/xslt KeyTable.java Stylesheet.java
  Log:
  Fixed several things with xsl:keys handling, including in imported 
stylesheets.
  
  Revision  Changes    Path
  1.14      +3 -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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- KeyTable.java     2000/05/31 08:33:49     1.13
  +++ KeyTable.java     2000/06/22 04:43:17     1.14
  @@ -108,7 +108,8 @@
     {    
       m_docKey = doc;
       XPathSupport execContext = xmlLiaison;
  -        
  +      
  +    /*
       try
       {
         // org.apache.xalan.xpath.dtm.DTMProxy docp = 
(org.apache.xalan.xpath.dtm.DTMProxy)doc;
  @@ -255,6 +256,7 @@
   
       }
       catch(ClassCastException cce)
  +    */
       {
         Node pos = startNode;
   
  
  
  
  1.34      +20 -4     xml-xalan/src/org/apache/xalan/xslt/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/Stylesheet.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Stylesheet.java   2000/03/03 20:22:35     1.33
  +++ Stylesheet.java   2000/06/22 04:43:17     1.34
  @@ -1113,6 +1113,7 @@
                                     String ref, PrefixResolver nscontext)
        throws org.xml.sax.SAXException
    {
  +    // System.out.println("In Stylesheet.getNodeSetByKey");
       NodeList nl = null;
       if(null != m_keyDeclarations)
       {
  @@ -1155,16 +1156,31 @@
       // mean there wasn't an xsl:key declared with the
       // given name.  So go up the import heiarchy and
       // see if one of the imported stylesheets declared it.
  -    if(null == nl)
  +    // if(null == nl)
       {
  +      // System.out.println("Processing imports");
         int nImports = m_imports.size();
         for(int i = 0; i < nImports; i++)
         {
           Stylesheet stylesheet = (Stylesheet)m_imports.elementAt(i);
  -        nl = stylesheet.getNodeSetByKey(tcontext, doc, name, ref, nscontext);
  -        if(null != nl)
  +        NodeList importednl = stylesheet.getNodeSetByKey(tcontext, doc, 
name, ref, nscontext);
  +        if(null != importednl)
           {
  -          break;
  +          if(null != nl)
  +          {
  +            if(nl instanceof NodeListImpl)
  +            {
  +              // Hack a roo
  +              nl = new MutableNodeListImpl(nl);
  +            }
  +            ((MutableNodeListImpl)nl).addNodesInDocOrder(importednl, 
  +                                                         
tcontext.getExecContext());
  +          }
  +          else
  +          {
  +            nl = importednl;
  +          }
  +          // break;
           }
         }
       }
  
  
  

Reply via email to