.. _position:
========
position
========
The current context position
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.
Examples
~~~~~~~~
.. list-table::
:widths: 25 25 50
:header-rows: 1
* - **XPath**
- **Results**
- **Explanation**
* - $in-xml/*[position() > 2]
- 3 4 5
-
* - $in-xml/a[position() > 2]
- 4 5
-
* - $in-xml/a[position() = 3]
- 4
- The expression [position() = 3] is equivalent to the expression [3].
.. list-table::
:widths: 50 50
:header-rows: 1
* - **XPath**
- **Results**
* - $in-xml/*[position() > 2]
- 3 4 5
* - $in-xml/a[position() > 2]
- 4 5
* - $in-xml/a[position() = 3]
- 4
See Also
~~~~~~~~
.. toctree::
:titlesonly:
:glob:
* :ref:`functx_first-node`.
* :ref:`functx_last-node`.
* :ref:`index-of`.
* :ref:`last`.