RE: union, intersect, and except

> Why are the union, intersect, and except operations limited 
> to working 
> on sequences of nodes? It seems to me that they are perfectly well 
> defined operations for sequences of arbitrary types, and that these 
> three operators should be declared to work on sequences of 
> item type. If 
> there's no good reason for limiting them to node()*, I would ask that 
> the signatures of these operators be revised to item()* instead.

At one stage the operations were defined like this, and it created a lot of
complexity. For example:

* For backwards compatibility, union is defined to return the result in
document order, but document order is not defined over atomic values

* An operator that compared nodes by identity, while comparing atomic values
by equality, would be confusing.

We then tried having two sets of operators, one over nodes and one over
atomic values. We eventually decided that this second set of operators were
too specialized to justify their inclusion in the core function library, and
that they could easily be written by users. They were therefore moved to the
appendix of illustrative user-written functions: see

http://www.w3.org/TR/xpath-functions/#union-intersect-except-on-values

Michael Kay 

Received on Sunday, 16 November 2003 19:17:28 UTC