Variables within variables are not evaluated correctly
------------------------------------------------------
Key: XALANJ-2373
URL: https://issues.apache.org/jira/browse/XALANJ-2373
Project: XalanJ2
Issue Type: Bug
Components: XSLTC
Affects Versions: 2.7
Environment: JDK 1.5, Xalan 2.7.0
Reporter: Michael Hedenus
Priority: Blocker
Under some conditions variables within variables are not resolved.
Here is a usecase. Run the following stylesheet with XSLTC and use the
stylesheet itself as input.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:java="http://xml.apache.org/xalan/java"
exclude-result-prefixes="xalan java">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="vars">
<var>var1</var>
<var>var2</var>
<var>var3</var>
<var>var4</var>
</xsl:variable>
<xsl:variable name="test">
<xsl:for-each select="xalan:nodeset($vars)/var">
<xsl:variable name="s1" select="substring-after(., 'var')"/>
<out org="{.}"><xsl:value-of select="$s1"/></out>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<test-result>
<xsl:copy-of select="$test"/>
</test-result>
</xsl:template>
</xsl:stylesheet>
The output should be (as it is correctly produced by Xalan interpretive)
<?xml version="1.0" encoding="UTF-8"?>
<test-result>
<out org="var1">1</out>
<out org="var2">2</out>
<out org="var3">3</out>
<out org="var4">4</out>
</test-result>
But XSTLC produces:
<?xml version="1.0" encoding="UTF-8"?>
<test-result>
<out org="var1"/>
<out org="var2"/>
<out org="var3"/>
<out org="var4"/>
</test-result>
Somehow the content of $s1 is gone empty! Under unrepeatable circumstances this
bug even leads to a NullPointerException.
I consider this bug to be very evil.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]