Error when XQuery sort keys are empty
The Saxon XSLT and XQuery processor, developed by Saxonica
Brought to you by:
mhkay
The error "Non-comparable types found while sorting:
Objects are not comparable" may be produced when
sorting in XQuery, if the value of a sort key is an
empty sequence. The problem occurs when lazy evaluation
is used to evaluate the sort key.
Source fix: in net.sf.saxon.sort.SortedTupleIterator,
change the "for" loop at line 57 to read:
for (int n=1; n<=sortkeys.length; n++) { Value v = tuple[n].reduce(); if (v instanceof EmptySequence) { nodeKeys[k+n] = null; } else { nodeKeys[k+n] = v; } }