xsl-list
[Top] [All Lists]

## RE: [xsl] Problem getting position of node

2006-03-21 02:13:11
```
By the "position" of the node I imagine you mean the number of preceding
sibling nodes (or elements?) plus one. You can get that using

count(preceding-sibling::node()) + 1

or

count(preceding-sibling::*) + 1

depending which you want.

You can also use <xsl:number/>.

The position() function gives you something quite different: its value is
unrelated to the position of a node in the tree, it depends only on the
position of the node within the sequence of nodes currently selected for
processing.

```
```  Error in expression concat(., parent::node()/position()): Unexpected
token [<function>] in path expression
```
```
XSLT 1.0 doesn't allow a function call on the rhs of "/". XSLT 2.0 does. But
parent::node()/position() will always return 1: a node has only one parent
and the position of that parent among all the parents is therefore always 1.

Michael Kay
http://www.saxonica.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

```
 Current Thread [xsl] Problem getting position of node, omprakash . v RE: [xsl] Problem getting position of node, Jarno.Elovirta RE: [xsl] Problem getting position of node, Michael Kay <= RE: [xsl] Problem getting position of node, omprakash . v RE: [xsl] Problem getting position of node, Michael Kay RE: [xsl] Problem getting position of node, omprakash . v RE: [xsl] Problem getting position of node, Michael Kay