Description
The fn:position function returns an integer representing the position (starting with 1, not 0) of the current context item within the context sequence (the current sequence of items being processed.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type |
return value |
xs:integer |
Examples<xsl:variable name="in-xml" as="item()*"> | | <in-xml>
<a>1</a>
<c>2</c>
<a>3</a>
<a>4</a>
<a>5</a>
</in-xml> |
| </xsl:variable> |
XPath Example | Results | Explanation |
---|
$in-xml/*[position() > 2] |
<a>3</a>
<a>4</a>
<a>5</a> |
$in-xml/a[position() > 2] |
<a>4</a>
<a>5</a> |
$in-xml/a[position() = 3] |
<a>4</a> |
The expression [position() = 3] is equivalent to the expression [3] . |
See AlsoHistory |
Recommended Reading:
|