Reverses the order of items in a sequence.
fn:reverse
( $arg
as item()*
item()*
The function returns a sequence containing the items in $arg
in reverse
order.
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 expression fn:reverse(([1,2,3],[4,5,6]))
returns ([4,5,6],[1,2,3])
.
If $arg
is the empty sequence, the empty sequence is returned.