Hi All,
Consider the following stylesheet (in which I removes the URIs for the namespaces, because the forum engine didn't like them):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="..." version="2.0"
xmlns:xs="..."
xmlns:test="test">
<xsl:template match="/">
<xsl:variable name="nodeWithChildren">
<root>
<a />
<a />
</root>
</xsl:variable>
<test-1>
<xsl:sequence select="for $n in $nodeWithChildren/root/a return $n/position()"/>
</test-1>
<test-2>
<xsl:sequence select="for $n in $nodeWithChildren/root/a return test:echo($n/position())"></xsl:sequence>
</test-2>
</xsl:template>
<xsl:function name="test:echo">
<xsl:param name="pos" as="xs:integer" />
<xsl:sequence select="$pos"/>
</xsl:function>
</xsl:stylesheet>
Running this with Altova XMLSpy (2008, rel 2, sp 2) returns "1 1" for both test-1 and test-2.
Running it with Saxon-B (v. 9.1.0.3) returns "1 2" for test-1 and "1 1" for test-2.
So, two questions:
* Who's right, who's wrong?
* How to tweak this code to get "1 2" in test-2?
Cordially,