Christian - On Sat, Aug 23, 2025 at 2:52 AM Christian Grün <[email protected]> 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 < > [email protected]> > *Gesendet:* Samstag, August 23, 2025 2:34:49 AM > *An:* BaseX <[email protected]> > *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 > > [1] https://docs.basex.org/main/Array_Functions#array:sort > > [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 > > [4] > https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-array-sort-by > > >

