reverse function

The fn:reverse function reverses the order of the items in a sequence.

Syntax

Read syntax diagramSkip visual syntax diagramfn:reverse( source-sequence)
source-sequence
The sequence that is to be reversed.

source-sequence is a sequence of items of any data type, or is the empty sequence.

Returned value

If source-sequence is not the empty sequence, the returned value is a sequence that contains the items in source-sequence, in reverse order.

If source-sequence is the empty sequence, the empty sequence is returned.

Example

The following function returns the items in sequence (1,2,3,7) in reverse order:
fn:reverse((1,2,3,7))

The returned value is (7,3,2,1).