[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Using Union/Intersect to Combine Two User-Defined Function Results

Jonathan Robie jonathan.robie at redhat.com
Tue Mar 25 16:40:40 PST 2008

  Using Union/Intersect to Combine Two User-Defined
	Function Results
Wei, Alice J. wrote:
> To answer your question, each of my local:searchresult functions as something like local:searchresult((collection("my")//ad/p[contains(upper-case(.),$search)])
>   is a self efficient XML document with several nodes within it. Each of the output is something like:
> <ad>
> <head type="main">
> <emph rend="red">FREE</emph>
> </head>
>         <p>Thousands of users actual decals for a 2 deuce coupe! You'll receive free
>                         over 100 different. use on your bike, model car, van, plane, or on glass
>                         painted surfaces, metal, plastic, etc. </p>     </ad>

Does local:searchresult() create new nodes? Each of these nodes will 
have a new ideintity.

> What I am trying to do here is to combine both of the result sets into one.
> Therefore, if a user intends to see the output of a search term and another term, he would only see the combined result.
> Would you say this is possible?

You can certainly do something like this:

let $a := collection("my")//ad/p[contains(upper-case(.),$search,
$b := collection("your")//ad/p[contains(upper-case(.),$search,
$c := collection("my")//ad/p[contains(upper-case(.),$search2,
$d := collection("your")//ad/p[contains(upper-case(.),$search2
local:searchresult( $a intersect $b intersect $c intersect $c )

By separating search from construction, you can rely on the identity of 
the original nodes.

Hope this helps!



Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.