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

Get collection context in XQuery

Michael Kay mike at saxonica.com
Fri Feb 6 11:49:33 PST 2009


  Get collection context in XQuery
The meaning of a collection URI varies from one implementation to another,
but you are only allowed one collection URI as the argument.
 
I think you want
 
for $uri in ("A", "B")
for $doc in collection($uri)
where ....
return document-uri($doc)
 
Michael Kay
http://www.saxonica.com/


  _____  

From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf
Of ricardo queiros
Sent: 06 February 2009 11:33
To: http://x-query.com/mailman/listinfo/talk
Subject:  Get collection context in XQuery


Hi, 

I'm a newbie in XQuery and i appreciate a answer to this doubt.

I store several XML documents in a Native XML Database (eXist).
In my organisation i have several collections with several XML files that
share the same structure. The following structure defines 2 collections A
and B. The collection A have 2 XML files and the collection B one. 

A
  - 1.xml
  - 2.xml
B
  - 3.xml 

I have his XQuery file:

FOR $x in collection("A","B")

WHERE ...
RETURN ?

If, for example, only the 2.xml and 3.xml were evaluate for TRUE in the
WHERE clause, i want to obtain the following XML data:

<RESULTS>
<A>2.xml<A>
<B>3.xml</B>
</RESULTS>

What should i put in the RETURN clause?

I can also have collections inside other collections...

Thanks in advance




-- 
Ricardo Queirós


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20090206/721154e1/attachment.htm


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.