Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.12.2
-
None
Description
There exists a problem in the xslt-transformation with xsl:variable in xsl:for-each loops
If you use a xsl:variable defined in an xsl:for-each only ONE time within the xsl:for-each it stores the correct value, if you use the variable multiple times it is always set to the value it gets in the first iteration of the xsl:for-each
Example:
a)
<xsl:template match="/Module"> <xsl:for-each select="Data"> <xsl:variable name="Entry" select="@entry"/> <xsl:value-of select="concat('value: ', $Entry, '
')"/> </xsl:for-each> </xsl:template
would output the expected value of the data for each iteration
b)
<xsl:template match="/Module"> <xsl:for-each select="Data"> <xsl:for-each select="Data"> <xsl:variable name="Entry" select="@entry"/> <xsl:value-of select="concat('value: ', $Entry, '
')"/> <xsl:value-of select="concat('value: ', $Entry, '
')"/> </xsl:for-each> </xsl:template>
would output only the first iterations value of the variable
Following example data:
<Module> <Data entry="1"/> <Data entry="2"/> <Data entry="3"/> </Module>
Output with QT5.12.2:
a)
value: 1 value: 2 value: 3
b)
value: 1 value: 1 value: 1 value: 1 value: 1 value: 1
while the correct output for b) should be
value: 1 value: 1 value: 2 value: 2 value: 3 value: 3
I attached a sample xml , xslt and source that does a transformation. (simply adjust the path to the files)
The output for the transformation with saxon, xalan and QT4.8.6 produces the correct result.