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: Sat, 16 Jan 2021 09:34:40 +0100
Message-ID: <CAP94bnPGjyCjc4cM0PSjdMoMMj=i2rBZYnZ7mJYkU0=n7hpD_w@mail.gmail.com>
To: Mukul Gandhi <gandhi.mukul@gmail.com>
Cc: Christian Grün <cg@basex.org>, public-xslt-40@w3.org
> For correctness sake, I guess you meant,
> sort($data, (), function($key) { 0 - $key })

Both are possible; see [1] for more details on unary expressions.

> Wouldn't this be inefficient, as compared to having a native "descending" argument to the fn:sort function?

I can’t talk for all implementations, but it’s easily optimizable (in
BaseX, you shouldn’t note the difference)

[1] https://www.w3.org/TR/xpath-30/#id-arithmetic
Received on Saturday, 16 January 2021 08:35:08 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 16 January 2021 08:35:09 UTC