Thanks Michael!

I looked into that and I think this means I need to use the 3-argument sort function isn't it?
I still do not exactly understand how that would work in my case. I have to sort "ItemGroupData" based on the values of ItemOID in something like:
<ItemGroupData ...>
   <ItemData ItemOID="A" .../>
   <ItemData ItemOID="B" .../>
</ItemGroupData>

where the values from @ItemOID come from an XPath _expression_ on another file which results in a sequence.

Many thanks,

Jozef

Michael Kay <[email protected]> hat am 11. Dezember 2017 um 23:13 geschrieben:

Use the higher-order sort() function in 3.1. This gives you much more flexibility in computing a sort key, and the sort key can be any sequence. The only limitation is it's tricky if you want some components (but not all) to be in descending order.

Michael Kay
Saxonica

On 11 Dec 2017, at 18:06, Jozef Aerts <[email protected]> wrote:


I am writing an XQuery to validate whether "records" (parent nodes) are unique based on a number of child elements and their attributes (like primary keys in relational). I do not know these "keys" in advance however, as they are generated from a query on another document. So sometimes I have only two "keys", but sometimes 10.

"order by" uses a list of comma-separated values, but as I don't know these values in advance, ...

Essentially, what I intend to do is something like:

$keys := ...  (: returns a sequence :)
...
for ...
order by $keys  (: throws an error of course at it expects a list of comma-separated values :)

Any tips how this can be done?

Many thanks in advance,

Jozef

_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk


 

_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to