[Home] [By Thread] [By Date] [Recent Entries]
How is the context defined when evaluating the 'use' attribute of an
'xsl:key' element, in particular what is the context size?
The XSLT specification in http://www.w3.org/TR/xslt20/#key merely says: "The expression will be evaluated with the node that matches the pattern as the context node." but it does not say what is the context size. I get different results from different XSLT processors, if the input XML is <root>
<data>
<item>1</item>
<item>2</item>
<item>3</item>
</data>
</root>and the stylesheet is <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:key name="k1" match="item" use="position()"/> <xsl:template match="/">
<xsl:value-of select="key('k1', 1)"/>
</xsl:template></xsl:stylesheet> then Saxon (tested with 9.2.0.5) and Gestalt output 1 2 3 meaning the context size is 1 each time the 'use' expression has been evaluated but AltovaXML tools and IBM's beta output 1 meaning the context size is not 1 for these processors. I suspect Saxon and Gestalt are right but I am having a hard time to find an argument for that in the specification. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



