[xsl] Re: displaying position of nodes

Subject: [xsl] Re: displaying position of nodes
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 21 Feb 2003 07:07:00 +0100
> Notice that position() gives you the position of an element relative to
> the top of the subtree it is in when matched by a template, and not
> necessarily the element count as you might have been expecting.


This is not true. The value of position() is determined by the relative
position of the current node in the node-list when the template is
instantiated -- that is by the expression in the "select"  attribute of the
xsl:apply templates that caused the instantiation.

For example, if the instantiation was caused by:

<xsl:apply-templates select="node()[3]"/>

then in the instantiated template

<xsl:value-of select="position()"/>

will produce '1'


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread