saxon:item-at()

saxon:item-at($seq as item()*, $index as numeric?) ==> item()?

This function returns the item at a given position in a sequence. The index counts from one. If the index is an empty sequence, or less than one, or not a whole number, or greater than the length of the sequence, the result is an empty sequence.

This function is provided largely because it is used internally by the Saxon optimizer. For user applications, it is better to use $seq[$index] which will return the same result provided there are no context-dependencies in $index, or subsequence($seq, $index, 1) which will return the same result in all cases where $index evaluates to an integer.

Example:

saxon:item-at(10 to 20, 8)

will return 17.