[xquery-talk] Incorrect Intersect and Except Output?

Michael Kay mike at saxonica.com
Mon Mar 31 18:08:16 PST 2008

>    Yes, I admit that I have not grasped this.
>    According to what you said, are you implying that it is 
> not even possible to even do an "outer-join" to produce the 
> output from
>   let $a := <a><b>1</b><b>2</b><b>3</b></a>,
>       $b :=<c><b>What</b><b>2</b><b>3</b><b>4</b></c>
> return
>  <foo>{(($a/b union $b/b) except ($a/b except $b/b))}</foo>
> to something like:
> <foo>
> <b>What</b>
> <b>1</b>
> <b>4</b>
> </foo>?

Of course it's possible. Just rewrite "X except Y" as "X[not(.=Y)]". You
need to test equality, not identity. The only difference is that this
doesn't eliminate duplicates - but you know how to do that from your
previous posts to this list.

Michael Kay

More information about the talk mailing list