I have already send this once to the xalan-dev list but didn't receive any resonse, so I will send it again. Maybe I need to be subscribed to that list? But on the Xalan page you can only subscribe to the user list, not to the developer list.

Hello,
this seems to be a bug in Xalan(Java):
If I apply this stylesheet:

<?xml version='1.0' encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:svg="http://www.w3.org/2000/svg"; xmlns:fox="http://xml.apache.org/fop/extensions";>
<xsl:output method="xml" indent="yes"/>


<xsl:template match="/doc">
<xsl:variable name="tricky" select="current()/@name"/>
        <xsl:message>
                <xsl:value-of select="$tricky"/>
        </xsl:message>

        <xsl:for-each select="//nasty">
                        <xsl:message>
                                <xsl:value-of select="$tricky"/>
                        </xsl:message>
        </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

to this xml file:

<doc name='rubbish'>
        <nasty name='gold'/>
</doc>

You will see the output of Xalan turning rubbish into gold!
The problem is obviously in the current() function in this line:
<xsl:variable name="tricky" select="current()/@name"/>

It seems to store the reference to a nodeset in the variable tricky instead of the nodeset itself. If I change current() to the equivalent "."(a dot) the example works as expected.

Best regards, Roland



Reply via email to