[xquery-talk] Paths, node sorting & node constructors
Frans Englich
frans.englich at telia.com
Sat Mar 15 11:46:51 PST 2008
One thing with XQuery that I am constantly tripping over in XQuery is
that the
result of sorting constructed elements is undefined. Consider this:
path/(<h3>{...}</h3>,
<p>{...}</p>)
For a query like that the user has no guarantees for the order of the
result,
and that is a bit counterintuitive. It's hard to blame the user who,
unaware
of the rules of node sorting, expects the above query to come out as
what the query "reads to".
(An implementation can to some degree fix this by skipping node sorting
or return appropriately when the node order is implementation defined.
But that is still implementation specific, and it also boils down to the
strength of the query analysis.)
So what can one recommend users to do? To go away from XPath-style, and
use a for loop instead?
Cheers,
Frans
More information about the talk
mailing list