Christian - 

On Sat, Aug 23, 2025 at 2:52 AM Christian Grün <cg@basex.org> wrote:
Dear Bridger,

Thanks for your observations. You are completely right, the documentation needs to be updated. The W3 sort function were revised multiple times in the recent past, which is why there are even some pending inconsistencies in the current spec.


Enjoy your time away!
 
I will be offline for a while, and I will take care of it once I am back.

Best, 
Christian


Cheers,
Bridger
 

Von: Bridger Dyson-Smith via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
Gesendet: Samstag, August 23, 2025 2:34:49 AM
An: BaseX <basex-talk@mailman.uni-konstanz.de>
Betreff: [basex-talk] array:sort, array:sort-by, and docs access

Dear Christian and BaseX friends, 
I hope this email finds you well! I had a question about function signatures:

it would seem that there's a typo/issue with the signature (and final example) for array:sort[1,2]. Shouldn't the signature for array:sort read:
array:sort(
  $array        as array(*),
  $collation   as xs:string?                                      := fn:default-collation(),
  $key           as fn(item()*) as xs:anyAtomicType* := fn:data#1
) as item()* 
(cribbed from the qt4cg.org specs[3])? Unless I'm misreading the signature... in which case, excuse me!

Additionally, the current signature for array:sort seems to be in approximate alignment with array:sort-by, which is missing from our lovely BaseX docs' array page. To further my confusion, it looks like the examples from the qt4cg.org array:sort-by[4] signature work generally in my BaseX 12.0. Could that be added, or is the function still waiting in the BaseX wings? :)

Best wishes,
Bridger


[2] the example `array:sort( [ 1, 2, 3 ], keys := fn($n) { -$n })` throws an error in BaseX 12.0:
[XPST0017] array:sort(array[,collation,key]): Unknown keyword: keys. 
I'll update the example if I may please have access, otherwise, change `keys` to `key`, please. 

[3] https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-array-sort