Christian Grün
2015-12-03 11:48:55 UTC
Hi everyone,
As you may know, XQuery 3.1 introduces an interesting new fn:sort
function, which can be used as alternative for the order by clause in
FLWOR expressions [1]. It can e.g. be used to sort numbers in a
descending order:
sort(
1 to 10,
function($k) { -$k }
)
I would be interested if anyone has already tried to get the
descending order working for strings?
sort(
('A', 'AA', 'B'),
function($k) { ... }
)
I assume that string-to-codepoints could be used, and all Unicode
points could then be negated, and additionally longer Unicode
sequences would need to be preferred over shorter ones… But maybe
there is a more concise solution?
Thanks in advance,
Christian
[1] http://www.w3.org/TR/xpath-functions-31/#func-sort
_______________________________________________
***@x-query.com
http://x-query.com/mailman/li
As you may know, XQuery 3.1 introduces an interesting new fn:sort
function, which can be used as alternative for the order by clause in
FLWOR expressions [1]. It can e.g. be used to sort numbers in a
descending order:
sort(
1 to 10,
function($k) { -$k }
)
I would be interested if anyone has already tried to get the
descending order working for strings?
sort(
('A', 'AA', 'B'),
function($k) { ... }
)
I assume that string-to-codepoints could be used, and all Unicode
points could then be negated, and additionally longer Unicode
sequences would need to be preferred over shorter ones… But maybe
there is a more concise solution?
Thanks in advance,
Christian
[1] http://www.w3.org/TR/xpath-functions-31/#func-sort
_______________________________________________
***@x-query.com
http://x-query.com/mailman/li