I have a simple xpath expression like this
for $x in (10 to 20) return $x
which simply return the sequence of integers between 10 and 20
Now, what if I wanted to return something like this instead
from the same sequence
1 2 3 4 ... 11
I want to get access to the "position" of $x in the sequence,
and also the total number of items in the sequence.
I tried something like this
for $x in (10 to 20) return $x/position()
XQuery has
for $x at $p in (10 to 20) return $p
where $x will range from 10 to 20 while $p ranges from 1 to 11. But that's
not available in XPath. In XPath you have to resort to
for $p in 1 to 11 ...
But if you really want to use position(), you can go back to
<xsl:for-each select="10 to 20">
....
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>
--~--