Re: [xsl] Obtaining a specific context position()

Subject: Re: [xsl] Obtaining a specific context position()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 8 Nov 2009 22:35:05 GMT
the value returned by position() is unrelated to the position of the node
in the source tree, it is just a function of the context selected by the
current xpath (for example if you select a node with . then it has
position()=1 whevever it appears in the source)

It's not clear really what you want for the subdiv version, in your
posted sample it was the same value as in the heading, in which case you
can just save it in a variable and use it twice.


<xsl:variable name="h" select="position()"/>

               <Heading>
                  <xsl:value-of select="$h"/> <!-- first call -->
                </Heading>

                <xsl:for-each-group select="current-group()" group-by="SubDiv1">
                <xsl:sort select="current-grouping-key()" collation="{$sorting-collation}"/>

                    <SubDiv1>
                  <xsl:value-of select="$h"/> <!-- second call -->

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread