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, O'Reilly Media. 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 Type| Name | Type |
| return value |
xs:integer |
Exampleslet $in-xml := | <in-xml>
<a>1</a>
<c>2</c>
<a>3</a>
<a>4</a>
<a>5</a>
</in-xml> | return |
| XQuery 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 |
|