You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ovidiu Predescu <ov...@cup.hp.com> on 2000/12/15 02:14:33 UTC

Re: applying templates on variables + PATCH

Gary,

Thanks for the suggestion! Here is the modified patch. Please let me know
whether this is correct or not. It seems to be fixing my problem. The patch is
against 1.2.1, sorry I didn't have time to look at 1.2.2.

--- xalan-j_1_2_1/src/org/apache/xalan/xpath/XRTreeFrag.java	Wed Nov 15 
07:09:47 2000
+++ xalan-j_1_2_1.modif/src/org/apache/xalan/xpath/XRTreeFrag.java	Thu Dec 14 
16:52:08 2000
@@ -56,8 +56,9 @@
  */
 package org.apache.xalan.xpath;
 
-import org.w3c.dom.*;
 import org.apache.xalan.xpath.xml.XMLParserLiaisonDefault;
+import org.apache.xalan.xslt.extensions.Nodeset;
+import org.w3c.dom.*;
 
 /**
  * <meta name="usage" content="general"/>
@@ -168,7 +169,13 @@
   public NodeList convertToNodeset()
   {
     return ((DocumentFragment)m_obj).getChildNodes();
-  }  
+  }
+
+    public NodeList nodeset()
+    {
+        Nodeset nodeset = new Nodeset();
+        return nodeset.nodeset(rtree());
+    }
   
   /**
    * Tell if two objects are functionally equal.


Regards,
-- 
Ovidiu Predescu <ov...@cup.hp.com>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://www.geocities.com/SiliconValley/Monitor/7464/


On Sun, 03 Dec 2000 19:58:30 -0800, Gary L Peskin <ga...@firstech.com> wrote:

> Ovidiu Predescu wrote:
> > 
> > The following template does not work with Xalan 1.2.1, while it works fine with
> > Saxon 5.5.1:
> > 
> >  <xsl:template match="page[split]">
> >   <xsl:variable name="page">
> >    <page>
> >     <xsl:copy-of select="@*"/>
> >     <xsl:copy-of select="child::*[preceding::split]"/>
> >    </page>
> >   </xsl:variable>
> >   <xsl:apply-templates select="$page"/>
> >  </xsl:template>
> > 
> > The first error I got was an exception as XRTreeFrag object could not be
> > converted to a NodeList. This was easily fixed by defining the nodeset()
> > method; here is a patch that does it:
> 
> Ovidiu --
> 
> Your patch does not properly implement the nodeset() extension.  You
> should use the one supplied with Xalan itself.  A result tree fragrment
> is equivalent to a node-set consisting of a single node that is the root
> node of the result tree.  Your patch creates a node-set consisting of
> all of the child nodes in the RTF.
> 
> Try this with the built-in nodeset extension and let us know if that
> works.
> 
> Gary
>