XPath/XQuery tail function

Summary

Returns all but the first item in a sequence.

Signature

fn:tail(
$arg as item()*
) as item()*

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

The function returns the value of the expression subsequence($arg, 2)

Examples

The expression fn:tail(1 to 5) returns (2, 3, 4, 5).

The expression fn:tail(("a", "b", "c")) returns ("b", "c").

The expression fn:tail("a") returns ().

The expression fn:tail(()) returns ().

The expression fn:tail([1,2,3]) returns ().

Notes

If $arg is the empty sequence, or a sequence containing a single item, then the empty sequence is returned.