[xquery-talk] Remove "duplicates" from a sequence

frederik at webinteract.nl frederik at webinteract.nl
Wed Nov 30 13:24:34 PST 2005


Given the following example in XQuery:

let $root := element root{}
return
	let $seq :=
		for $i in (1, 2)
		return $root
	return $seq

This will return a sequence <root/><root/>.
I would like the output to be only <root/> (so with no "duplicates").

In Saxon (and Galax) this can be done with the following query:
let $root := element root{}
return
	let $seq :=
		for $i in (1, 2)
		return $root
	return $seq intersect $seq

However, how can this be correct since a sequence can not contain duplicates?

For the record, the Altova XQuery processor does return <root/><root/>.


Kind regards,
Frederik & Tom.



More information about the talk mailing list