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 <xqu...@xml4pharma.com> 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
> 
> _______________________________________________
> talk@x-query.com
> http://x-query.com/mailman/listinfo/talk

_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to