Summary of Sorting Functions

These are the sorting functions I could find for XPath
https://doc.orbeon.com/xforms/xpath/standard-functions#exforms-functions

exf:sort(
    $sequence   as item()*,
    $sort-key   as xs:string,
    $datatype   as xs:string?,
    $order      as xs:string?,
    $case-order as xs:string?
) as item()*

https://web.archive.org/web/20120706065000/http://exforms.org/sorting.html
https://docs.seneca.nl/Formulierenserver-Docs/XForms/XForms-Extensions/Extension-functions/The-sort()-function.html

   node-set exf:sort(node-set data, string xpath-expr, string? data-type, string? ascending-descending, string? lowerfirst-or-upperfirst)
   node-set sxf:sort(node-set expression, sort expression, language, data-type, order, case-order) 

   node-set expression: Required XPath expression used to select the nodes which must be sorted.
   sort expression: Required XPath expression used for selecting the keys on which to sort.
   language (optional): Specifies the locale used for sorting the keys. Defaults to an empty string, in which case the system environments default locale is used.
   data-type (optional): Specifies the type of data for sorting purposes: text or number (text is the default).
   order (optional): Specifies the sorting order: ascending or descending (ascending is the default).
   case-order: Specifies how to sort uppercase and lowercase letters: none, upperfirst or lowerfirst (upperfirst is the default).

https://doc.orbeon.com/xforms/xpath/extension-functions/extension-xml#xxf-sort

xxf:sort(
    $sequence   as item()*,
    $sort-key   as item(),
    $datatype   as xs:string?,
    $order      as xs:string?,
    $case-order as xs:string?
) as item()*

   … the sort keys used to be a string, and we made it a path... but that may not be correct from xpath semantics
   … the key should really be a function but we can't support that

https://www.w3.org/TR/xpath-functions-31/#func-sort

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

Steven

Received on Friday, 26 March 2021 13:05:57 UTC