See Diff 1.0 vs 2.0. That one is solved, but it is still a bit of a mystery to me what caused the issue in the first place.
Now I may have found something, but need help understanding what is going on.
I simplified the input xml to
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Manager>
<Employee grade="9"/>
<Employee grade="8"/>
</Manager>
<Manager>
<Employee grade="9"/>
<Employee grade="8"/>
<Employee grade="4"/>
</Manager>
</root>
The stylesheet I apply on this input is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<root>
<xsl:apply-templates select="root/Manager"/>
</root>
</xsl:template>
<xsl:template match="Manager">
<test><xsl:value-of select="Employee/@grade"/></test>
</xsl:template>
</xsl:stylesheet>
The output is
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>9</test>
<test>9</test>
</root>
But running the transformation in XSLT 2.0 mode (change stylesheet/@version to “2.0”), the output is
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>9 8</test>
<test>9 8 4</test>
</root>
I wonder what precise difference in XSLT 1.0 and XSLT 2.0 causes this.
Well for the first difference I did explain that with XSLT 2.0 the comparison operators like less than or greater than or less than or equal and so on by default compare strings while with XSLT 1.0 these operators are only defined for numbers and that way convert any operands to numbers.
For this post the difference is simply that with XSLT 1.0
xsl:value-of select="foo"outputs the string value of the firstfooelement in the selected node set offooelements while with XSLT 2.0 this has changed, if a sequence is selected then a space separated list of the string value of item in the sequence is output. You can change the separator (i.e. space) used with theseparatorattribute ofxsl:value-ofin XSLT 2.0. See also http://www.w3.org/TR/xslt20/#incompatibilities.