XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Functions for sequences
A sequence; the copy of the input sequence with reversed order of the items contained in it.
A sequence of any number of items of any type which are copied and reversed in their order for the output sequence.
Purpose of use:
The fn:reverse() function returns the items of an input sequence in reversed order as output sequence. So, the first item of the input sequence becomes the last item of the output sequence, the last item of the input sequence becomes the first item of the output sequence.
The value and the data type of each item are preserved.
If the input sequence only consists of one item, it is returned unchanged. If the empty sequence is passed on to the function, it returns an empty result sequence accordingly.
Example – reversion of the order of the items of a sequence:
fn:reverse(('a', 'b', 'c'))
results in: ('c', 'b', 'a'). The last item of the input sequence becomes the first item of the output sequence and vice versa.
The function is not available.
fn:reverse($arg as item()*) as item()*
|<< back||next >>|
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany