Re: improvements to fn:sort functions

If the input is numeric, the function argument can be used for that:

  sort($data, (), function($key) { -$key })

In others, you can use a subsequent fn:reverse call:

  reverse(sort($data))

Maybe that's already sufficient?



Mukul Gandhi <gandhi.mukul@gmail.com> schrieb am Fr., 15. Jan. 2021, 05:53:

> Hi all,
>     Currently, there are three XPath 3.1 fn:sort functions defined (in the
> section 16.2.6 fn:sort of the XPath 3.1 F&O spec). There is no provision in
> these functions, to specify the sort order (i.e, ascending or descending
> sorting). I guess, currently only ascending sorting is available by these
> functions.
>
> I propose, to add an optional trailing parameter [$sortOrder as
> xs:integer] to the three fn:sort functions. The value 0 can be for
> ascending sorting (which could be default), and value 1 for descending
> sorting.
>
>
> --
> Regards,
> Mukul Gandhi
>

Received on Friday, 15 January 2021 06:32:03 UTC