Quip 2.2.1.1: Bug in distinct-values

I’m a newbie but it looks to me as if there is a bug in the implementatione of distinct-values. http://www.w3.org/TR/2001/WD-xquery-20011220/ states that:


The distinct-values function takes a sequence of nodes or values as input, and returns a sequence in which duplicates have been removed by value. The order of this sequence is not significant. Two elements are considered to have duplicate values if their names, attributes, and normalized content are equal.


In the following example I only get the first element though the two elements have different attribute values.



{
for $x in distinct-values((, ))
return $x
}



I’ll very much appreciate a fast respons as I’m going for the exam in 18 hours…

Regards,
Bjarke

Where did that wink come from?! I didn’t make it - it should have been a right parenthes.

The spec of this function has changed subtly in different versions of the XQuery working draft. In more recent specs, nodes are considered distinct only if they have different typed-values. The attributes of an element are not part of the typed value, so they are not taken into account.

Michael Kay
Software AG