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

Using Union Operator without Duplicate Records

Alice Wei ajwei at indiana.edu
Sat Dec 29 20:25:49 PST 2007


  Using Union Operator without Duplicate Records
Hi,

  Sorry, I should have put down the XML output I intend to have. The 
@type is only used
to extract the values, so I don't need to keep the attribute in my code.

  This is the XML output I have now:

  <author>Gene Pidzarko</author>
  <author>Michelle Scott</author>
  <author>Michelle Scott</author>
  <author>Ravi Pherwani</author>
   <!--More Code-->

This is the XQuery I have:

{for $file in doc("resume_2.xml")//author
let  $author := distinct-values($file[./@type='co-author' ] union
$file[./@type='Faculty'])
order by $author ascending
return  <li>{data($author)}</li>
}

I want the entire output to order by their first names in ascending 
order, but now it is
only extracting the different values from different sets of nodes with 
<author> in them
to order it.

My original XML looks something like this:

<projection>
<!--More code from other nodes-->
<author type="co-author">Andrew Tawfik</author>
<author type="co-author">Chris Hosler</author>
<author type="co-author">Michelle Scott</author>
</projection>

This is what I want:

  <author>Gene Pidzarko</author>
  <author>Michelle Scott</author>
  <author>Ravi Pherwani</author>

Is this possible?

Thanks for your help.

Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
http://x-query.com/mailman/listinfo/talk
812-856-2659

Quoting Florent Georges <http://x-query.com/mailman/listinfo/talk>:

> Alice Wei wrote:
>
>  Hi
>
>>    I am not sure if any one of you have tried using the union
>> operator to concatenate all the results without duplicates.
>
>  I am not sure what you want to achieve.  Could you please post an
> example of your input, as well as the corresponding expected output?
>
>  Regards,
>
> --drkm
>>>
> _____________________________________________________________________________
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers
> Yahoo! Mail http://mail.yahoo.fr
>



Purchase Stylus Studio Online Today!

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.
Email
First Name
Last Name
Company
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-2007 All Rights Reserved.