fn:sort

Sorts a supplied sequence, based on the value of a sort key supplied as a function, using the supplied collation. Calling the single-argument version of the function is equivalent to calling the 3-argument form with fn:default-collation() as the second argument and fn:data#1 as the third argument: that is, it sorts a sequence of items according to the typed value of the items.

sort($input as item()*) ➔ item()*

Arguments

 

$input

item()*

The input sequence to be sorted

Result

item()*

sort($input as item()*, $collation as xs:string?) ➔ item()*

Arguments

 

$input

item()*

The input sequence to be sorted

 

$collation

xs:string?

The collation

Result

item()*

sort($input as item()*, $collation as xs:string?, $key as function(item()) as xs:anyAtomicType*) ➔ item()*

Arguments

 

$input

item()*

The input sequence to be sorted

 

$collation

xs:string?

The collation

 

$key

function(item()) as xs:anyAtomicType*

The sort key

Result

item()*

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

Notes on the Saxon implementation

Available since Saxon 9.7. Signature changed to add $collation argument from 9.7.0.8.