xsl-list
[Top] [All Lists]

RE: [xsl] org.apache.xpath.objects.XRTreeFrag error

2007-03-26 01:32:28
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(_at_)yahoo(_dot_)com(_dot_)br] 
Sent: 26 March 2007 03:29
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Res: [xsl] 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(_at_)saxonica(_dot_)com>
Para: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Enviadas: Domingo, 25 de Março de 2007 20:42:07
Assunto: RE: [xsl] 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(_at_)yahoo(_dot_)com(_dot_)br]
Sent: 26 March 2007 00:26
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Res: [xsl] 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(_at_)yahoo(_dot_)fr>
Para: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Enviadas: Domingo, 25 de Março de 2007 14:29:34
Assunto: Re: [xsl] 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






















    

    
        
______________________________________________________________
_____________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
questions !
Profitez des connaissances, des opinions et des expériences des 
internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--