[Bug 1314] fn:distinct-values should not accept incomparable types


------- Additional Comments From mike@saxonica.com  2005-05-09 22:32 -------
I actually attempted to implement the previous specification of distinct-values,
when non-comparable values were considered an error, and I found it very
difficult to achieve; I found the current specification much easier to implement
(my implementation is based on hashing using a simple hash function based on
both the value and the type label). So let's base the argument on what's right
for users, not on implementation factors, which are likely to vary from one
implementor to another.

>From a usability point of view, XML Schema supports union types, and the typed
value of a collection of nodes can therefore contain a mixture of different
atomic types. It seems to me a most unfriendly and unnecessary restriction to
tell users that they can't invoke distinct-values() on a collection whose schema
definition is a union type. 

Note also that although sorting in XQuery disallows mixed types, sorting and
grouping in XSLT do not, so the consistency argument works both ways.

Michael Kay

Received on Monday, 9 May 2005 22:32:11 UTC