Thanks Henry! 

Your patch worked, but I found an other bug, which is not even fixed in the 
actual xalan head:
(I did a download from CVS and compiled it.)

Bug 3:
Passing a nodeset by <xsl:with-param ...> like this
            <xsl:call-template name="test2">
                <xsl:with-param name="nodes" select="str:tokenize($s, ' ')"/>
            </xsl:call-template>
doesn't work correctly.

Output of the following xslt with XSLTC (last element is missing)
Elements1:
id_10019_2382
id_10019_2383
Elements2:
id_10019_2382

Output of the following xslt without XSLTC (correct)
Elements1:
id_10019_2382
id_10019_2383
Elements2:
id_10019_2382
id_10019_2383



<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:str="http://exslt.org/strings";  exclude-result-prefixes="str">
    <xsl:key name="ElementIndex" match="*" use="@id"/>
    <!-- root template -->
    <xsl:template match="/">
        <xsl:element name="test">
            <xsl:variable name="s">id_10019_2382 id_10019_2383</xsl:variable>
            <xsl:call-template name="test1">
                <xsl:with-param name="s" select="$s"/>
            </xsl:call-template>
            <xsl:call-template name="test2">
                <xsl:with-param name="nodes" select="str:tokenize($s, ' ')"/>
            </xsl:call-template>
        </xsl:element>
    </xsl:template>
    <xsl:template name="test1">
        <xsl:param name="s"/>
        <xsl:variable name="nodes" select="str:tokenize($s, ' ')"/>
        <xsl:variable name="elements" select="key('ElementIndex', $nodes)"/>
        <xsl:message>Elements1:</xsl:message>
        <xsl:message>
            <xsl:value-of select="$elements[1]/@id"/>
        </xsl:message>
        <xsl:message>
            <xsl:value-of select="$elements[2]/@id"/>
        </xsl:message>
    </xsl:template>
    <xsl:template name="test2">
        <xsl:param name="nodes"/>
        <xsl:variable name="elements" select="key('ElementIndex', $nodes)"/>
        <xsl:message>Elements2:</xsl:message>
        <xsl:message>
            <xsl:value-of select="$elements[1]/@id"/>
        </xsl:message>
        <xsl:message>
            <xsl:value-of select="$elements[2]/@id"/>
        </xsl:message>
    </xsl:template>
</xsl:transform>

Input XML:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <Item id="id_10019_2382">
        <Name>Hugo</Name>
    </Item>
    <Item id="id_10019_2383">
        <Name>Emil</Name>
    </Item>
</test>


Is it possible to fix this in XALAN 2.7.0?

Thanks, 
Karsten




> -----Ursprüngliche Nachricht-----
> Von: Henry Zongaro [mailto:[EMAIL PROTECTED] 
> Gesendet: Dienstag, 5. Juli 2005 16:31
> An: Theis, Karsten
> Cc: [email protected]
> Betreff: Re: Bugs using 'key' and 'tokeinze' with XSLTC
> 
> Hi, Karsten.
> 
> > --- 1. Bug: ---
> > If I use a key like with a node set as parameter like this:
> >   <xsl:variable name="elements2" select="key('ElementIndex', 
> > $elements1/@id)"/> the result is invalid.
> 
>      This appears to be the same as the bug reported in Jira 
> issue XALANJ-1938.[1]  The fix for that problem is available 
> in the CVS or you can wait for the upcoming Xalan-J 2.7.0 release.
> 
> > --- 2. Bug ---
> > Result of xalan:tokenize in invalid
> >           str:tokenize is valid
> 
>      Please open a Jira issue for this problem,[2] and 
> somebody will investigate.
> 
> Thanks,
> 
> Henry
> [1] http://issues.apache.org/jira/browse/XALANJ-1938
> [2] http://issues.apache.org/jira/
> ------------------------------------------------------------------
> Henry Zongaro      Xalan development
> IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
> mailto:[EMAIL PROTECTED]
> 
> 

Reply via email to