[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 23:06:36 PST 2007


  Using Union Operator without Duplicate Records
------------------------------------------------
Alice Wei wrote:

Thanks, now it is working a lot better than before. But there is one 
little problem, since I have other "children" under project that are 
not to be selected in this set of XQuery, is it not possible to just 
state some for statements instead of putting in the entire code?

The other thing is, I have placed all the other "sections" within the 
original XML file into this code, and now the output from A-R is 
running in an orderly fashion. But, somehow the one that has the first 
name with an S is at the beginning of the list.

For both questions, could you please send, as before, a Minimal 
Complete Sample? That is, a sample with a complete input, the query you 
wrote so far, and your expected output. The input and the query should 
be as minimal as possible, but still reproducing the problem and 
complete (so readers of the list could run it easily).

   The issue is that I have a lot of similar structures like the small 
set of XML in the following example. What I intend to do is to only 
"extract" the author part and order them using distinct-values.

XML:

<projection>
<project_title>Poetry in XML</project>
<author type="co-author">Gene Pidzarko</author>
<author type="Faculty">Chris Lee</author>
<description>Using XML to encode scholarly texts.</description>
</projection>

    The code below works great, but is it possible to shorten the "for" 
clause so that it looks something like

for $project in doc("resume_2.xml")//author

without using the XML embedded inside to shorten the code?

The XQuery:

declare boundary-space preserve;
<project>
{
for $a in
<projection>
<author type="co-author">Gene Pidzarko</author>
<author type="Faculty">Chris Lee</author>
</projection>
/ distinct-values(.//author[@type = ('co-author', 'Faculty')]) order by 
$a ascending return <author> { data($a) } </author>
}
</project>

Thanks for your help.

Alice

Regards,

--drkm

_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! 
Mail
http://mail.yahoo.fr

_______________________________________________ http://x-query.com/mailman/listinfo/talk 
http://x-query.com/mailman/listinfo/talk

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



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.