W3C home > Mailing lists > Public > public-xslt-40@w3.org > January 2021

Re: improvements to fn:sort functions

From: Christian Grün <cg@basex.org>
Date: Fri, 15 Jan 2021 07:31:13 +0100
Message-ID: <CAP94bnMLRX7PNmfU41Hiw7wKcJveHth8FCARx9bSYWi5P4cTDQ@mail.gmail.com>
To: Mukul Gandhi <gandhi.mukul@gmail.com>
Cc: public-xslt-40@w3.org
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

This archive was generated by hypermail 2.4.0 : Friday, 15 January 2021 06:32:03 UTC