RE: NULL strings... necessary?

> I should also mention that XQuery's order by clause (part of 
> the FLWOR 
> expression) allows query authors to specify whether empty 
> sequences sort 
> less than or greater than all non-empty-sequence values.

And you can also make the empty sequence sort equal to the zero-length
string by writing the sort key as string(sort-key), for example string(@x).
That's particularly useful if there are multiple sort keys, so you want

order by string(@x), string(@y)

to sort on @y for both the cases where @x is absent and @x="". 

This is just to emphasize the point that collation is only about ordering of
a set of strings, it's up to the host language to build on this to define
higher-level sorting capability.

Michael Kay
http://www.saxonica.com/

Received on Sunday, 29 May 2005 21:05:58 UTC