Re: [xsl] question on EXSLT data partitioning

Subject: Re: [xsl] question on EXSLT data partitioning
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 20 Oct 2010 16:17:49 +0200
Erwan AMOUREUX wrote:
I frequently use this with msmxl or altova engine.
In that case, it's a 'default' position() by  parent node , using the xml tree entirely .

Well the XSLT 2.0 specification at least is clear about that, see which says "When the key specifier of that xsl:key declaration is evaluated with a singleton focus based on $N". Singleton focus means "A singleton focus based on a node N has the context item (and therefore the context node) set to N, and the context position and context size both set to 1".

I am sure some months ago I filed a bug on the AltovaXML Tools engine and at least their XSLT 2.0 engine in the version "AltovaXML Community Edition Version 2011" correctly implements that by now. So with the XML input being


and the stylesheet being


<xsl:output method="text"/>

  <xsl:key name="context-position" match="foo" use="position()"/>
  <xsl:key name="context-size" match="foo" use="last()"/>

<xsl:template match="/">
<xsl:value-of select="count(key('context-position', 1)), count(key('context-size', 1))" separator="&#10;"/>


the result is


with both Saxon 9.2 and the AltovaXML Tools engine with the version named above.


	Martin Honnen

Current Thread