home contribute faq download

FunctX XSLT Functions


The current context position



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 Type

return value xs:integer


<xsl:variable name="in-xml" as="item()*">
XPath ExampleResultsExplanation
$in-xml/*[position() > 2]
$in-xml/a[position() > 2]
$in-xml/a[position() = 3]
The expression [position() = 3] is equivalent to the expression [3].

See Also

functx:first-nodeThe XML node in a sequence that appears first in document order
functx:last-nodeThe XML node in a sequence that is last in document order
fn:index-ofThe position(s) of an atomic value within a sequence
fn:lastThe size of the current context


Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XSLT Services

Recommended Reading: