You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Roland <ro...@netquant.com.br> on 2002/02/27 03:41:01 UTC

Xalan Bug: transform rubbish into gold

Hello,
this seems to be a bug:
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