fn:reverse
Reverses the order of items in a sequence.
Signature
fn:reverse($arg as item()*) as item()*Properties
This function is deterministic, context-independent, and focus-independent.
Rules
The function returns a sequence containing the items in $arg in reverse
order.
Notes
If $arg is the empty sequence, the empty sequence is returned.
Examples
let $abc := ("a", "b", "c")The expression fn:reverse($abc) returns ("c", "b", "a").
The expression fn:reverse(("hello")) returns ("hello").
The expression fn:reverse(()) returns ().
The expression fn:reverse([1,2,3]) returns [1,2,3]. (The input is a sequence containing a single item (the array)).
The expression fn:reverse(([1,2,3],[4,5,6])) returns ([4,5,6],[1,2,3]).