Using Union/Intersect to Combine Two User-Defined Function ResultsWei, Alice J. ajwei at indiana.edu
Tue Mar 25 17:19:32 PST 2008
_______________________________________ From: Jonathan Robie [http://x-query.com/mailman/listinfo/talk] Sent: Tuesday, March 25, 2008 4:40 PM To: Wei, Alice J. Cc: http://x-query.com/mailman/listinfo/talk Subject: Re: 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 return 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! This last one really did the trick. Thanks! Alice
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format