intersection in XQuery

intersection in XQuery

Posted on September 02, 2008 0 Comments

A recent and rather simple question.

I have two sequences, let's say 1,2,3 and 2,3,4 and I need to get the items that exist in both, in this case 2,3

One could think to use the union and intersect operators, available in XQuery. Unfortunately, these operators are based on node identity, the arguments are sequences of nodes not atomic values.

So, there were a few answers of the form $seq1[. = $seq2]
Which is ok if you don’t mind about possible duplicate values in the result.

I would consider using the FunctX XQuery library. It includes a number of set-operation functions.

There are of course many more functions in FunctX which will be handy one day or the other during your XQuery programming. And remember DataDirect XQuery has been certified with FunctX. Maybe consider to add the FunctX function library to your XQuery tools set?

Marc Van Cappellen

View all posts from Marc Van Cappellen on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation