RE: [xsl] Curious result of the position() function

Subject: RE: [xsl] Curious result of the position() function
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Thu, 29 Jul 2004 10:51:34 -0400
> From: David Carlisle [mailto:davidc@xxxxxxxxx]

> > I believed that the position() function should give me the position
> number
> > of the node in the node set.
> "set" always implies an unordered data structure, there is no postion
> a set. It does give the position in the current node list, which in
> scase consists of, alternately an element node and a text node (with
> white space in it)

Just to augment what David said, you will get the expected results if
you select just the specific nodes you are interested in.  For example,
this will give you the position() results you expected -

<xsl:template match="/">
    <xsl:apply-templates select='/document/table/row'/>

Now, only the "row" elements get fed to the template, so the position()
values reflect a row's position among just the other rows.


Tom P

Current Thread