[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

Wei, Alice J. ajwei at indiana.edu
Tue Mar 25 15:15:23 PST 2008

  Using Union/Intersect to Combine Two User-Defined
	Function Results
Hi, XQueriers:

   I am working on a search engine and right now I am making attempts to combine two sets of results using union, intersect or except operators. Here is a snippet:

 if (($search ne "") and ($search2 eq "address") and ($search3 eq "address") and ($search5  ne "") and ($search7 eq "and") and ($search6 eq "") and ($search4 eq  "head") and ($search8 eq "and"))
then <div><p>This is Your Term of Search : {$search} in &#60;{$search2}&#62; {$search7} {$search5} in &#60;{$search3}&#62;</p>
{local:count-distinct-values(collection("my")//ad//address[contains(., $search)])} intersect {local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }
else <p>I don't know what you want.</p>

If I tried using another curly brace to surround the above statements and have my function call as in: {local:count-distinct-values(collection("my")//ad//address[contains(., $search)]) intersect local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }

This bring me no output and no errors.

However, if I use the {local:count-distinct-values(collection("my")//ad//address[contains(., $search)])} intersect {local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }

it gives me the first part of the query, with the actual word, intersect in between, and followed by the second portion of the query after the word "intersect."

Have I missed something here? How can I call my query and have the two results combined together?

Thanks to those who can help.

Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington


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.