[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: org.apache.xpath.objects.XRTreeFrag error

Subject: RE: org.apache.xpath.objects.XRTreeFrag error
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 26 Mar 2007 09:32:01 +0100
RE:  org.apache.xpath.objects.XRTreeFrag error
You haven't shown us the code that calls check_identical. This may need
similar changes.

It also seems that you haven't yet understood the explanation of what this
error message means. When you use xsl:variable, xsl:param, or xsl:with-param
in XSLT 1.0 you are creating a result tree fragment. The only things XSLT
1.0 allows you to do with an RTF are to convert it to a string or to copy it
(using xsl:copy-of). In particular you can't use it in a path expression.
This restriction is removed in XSLT 2.0. In 1.0 you can usually get around
it, if you need to, by calling the xx:nodeset() extension function available
in most products. But the code you showed us was creating RTFs quite
unnecessarily, and the better solution is to avoid creating them if you
don't need them.


Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Lepoldo Melo [mailto:leopoldosmj@xxxxxxxxxxxx]
> Sent: 26 March 2007 03:29
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Res:  org.apache.xpath.objects.XRTreeFrag error
>
> I've already done the changes, but I'm still getting the
> error on line "<xsl:for-each select="$node/*/*">". I don't
> know how to avod this tree fragment.
>
> The new code is bellow.
>
>     <xsl:template name="check_identical">
>         <xsl:param name="comp1"/>
>         <xsl:param name="comp2"/>
>         <xsl:variable name="string1">
>             <xsl:call-template name="stringify">
>                 <xsl:with-param name="node" select="$comp1"/>
>             </xsl:call-template>
>         </xsl:variable>
>         <xsl:variable name="string2">
>             <xsl:call-template name="stringify">
>                 <xsl:with-param name="node" select="$comp2"/>
>             </xsl:call-template>
>         </xsl:variable>
>         <xsl:value-of select="$string1=$string2"/>
>     </xsl:template>
>
>     <xsl:template name="stringify">
>         <xsl:param name="node"/>
>         <xsl:for-each select="$node/*/*">
>             <xsl:choose>
>                 <xsl:when test="boolean(local-name())">&lt;
>                     <xsl:value-of select="local-name()"/>
>                     <xsl:variable name="pos" select="position()"/>
>                     <xsl:for-each select="@*">
>                         <xsl:text> </xsl:text>
>                         <xsl:value-of
> select="local-name()"/>="<xsl:value-of select="."/>"</xsl:for-each>
>                     <xsl:call-template name="stringify">
>                         <xsl:with-param name="node" select="."/>
>                     </xsl:call-template>&lt;/
>                     <xsl:value-of
> select="local-name()"/>&gt;</xsl:when>
>                 <xsl:otherwise>
>                     <xsl:value-of select="normalize-space(.)"/>
>                 </xsl:otherwise>
>             </xsl:choose>
>         </xsl:for-each>
>     </xsl:template>
>
>
> Thanks a lot.
> Leopoldo
>
>
> ----- Mensagem original ----
> De: Michael Kay <mike@xxxxxxxxxxxx>
> Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Enviadas: Domingo, 25 de Margo de 2007 20:42:07
> Assunto: RE:  org.apache.xpath.objects.XRTreeFrag error
>
> If you make the changes to avoid the unnecessary copying of
> data into result tree fragments (as suggested in my earlier
> response) then you should not be getting this error.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Lepoldo Melo [mailto:leopoldosmj@xxxxxxxxxxxx]
> > Sent: 26 March 2007 00:26
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Res:  org.apache.xpath.objects.XRTreeFrag error
> >
> > My code is ok, but it doesn't work with Xalan 2.5.2.
> >
> > The error is described at
> >
> http://www.biglist.com/lists/xsl-list/archives/200505/msg00391.html.
> >
> > The XRTreeFrag error happens on line "<xsl:for-each
> > select="$node/*/*">".
> >
> > ----- Mensagem original ----
> > De: Florent Georges <darkman_spam@xxxxxxxx>
> > Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Enviadas: Domingo, 25 de Margo de 2007 14:29:34
> > Assunto: Re:  org.apache.xpath.objects.XRTreeFrag error
> >
> > Lepoldo Melo wrote:
> >
> >   Hi
> >
> > > Okay. Thanks, but I still don't know how to solve the line
> > > "<xsl:for-each select="$node/*/*">".
> >
> >   What do you mean by "solving"?
> >
> >   Your code seems ok with that, both in XSLT 1.0 and 2.0
> (as long as
> > in XSLT 1.0 you pass a reference to an input tree, and what
> you showed
> > is not enough to be sure on that point).
> >
> >   So what exactly is the problem?
> >
> >   Regards,
> >
> > --drkm
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ______________________________________________________________
> > _____________
> > Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos
> > questions !
> > Profitez des connaissances, des opinions et des expiriences des
> > internautes sur Yahoo! Questions/Riponses
> http://fr.answers.yahoo.com
> >
> >
> >
> >
> >
> > __________________________________________________
> > Fale com seus amigos  de graga com o novo Yahoo! Messenger
> > http://br.messenger.yahoo.com/
>
>
>
>
>
> __________________________________________________
> Fale com seus amigos  de graga com o novo Yahoo! Messenger
> http://br.messenger.yahoo.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.