xalan:evaluate looses variable content
--------------------------------------
Key: XALANJ-2485
URL: https://issues.apache.org/jira/browse/XALANJ-2485
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: Xalan
Affects Versions: 2.7.1
Environment: Win 2000, JDK 1.4.2
Reporter: Alexander Rohde
Priority: Critical
In a project I am dynamically evaluating expressions, now I want to migrate
from Xalan 2.4.1 to 2.7.1 mainly for performance reasons, however the
xalan:evaluate functions seems to "loose" variable content. I created a repro
for better investigation possibilities. Given the XML:
<?xml version="1.0"?>
<doc>
<atts>
<att>foo</att>
<att>bar</att>
</atts>
<a>
<b c="foo">1</b>
<b c="bar">2</b>
</a>
<a>
<b c="foo">3</b>
<b c="bar">4</b>
</a>
</doc>
and the stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xalan="http://xml.apache.org/xalan">
<xsl:template match="doc">
<xsl:for-each select="a">
<xsl:call-template name="processAVanilla"/>
</xsl:for-each>
<xsl:for-each select="a">
<xsl:call-template name="processAEvaluate"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="processAVanilla">
<xsl:variable name="curnode" select="."/>
<xsl:for-each select="/doc/atts/att">
<xsl:variable name="att" select="."/>
<xsl:value-of select="concat('-', $curnode/b...@c=$att], '- ')"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="processAEvaluate">
<xsl:variable name="curnode" select="."/>
<xsl:for-each select="/doc/atts/att">
<xsl:variable name="att" select="."/>
<xsl:value-of select="concat('-',
xalan:evaluate('$curnode/b...@c=$att]'), '- ')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
you will be able to see that the two templates processAVanilla and
processAEvaluate do not produce the same output. The only difference between
the two is that I am using xalan:evaluate in the second one. In the second
template only the evaluation only succeeds for the first time the for-each loop
runs.
Thanks in advance for looking into it.
Alex
--
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]