[xquery-talk] Get collection context in XQuery

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


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: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of ricardo queiros
Sent: 06 February 2009 11:33
To: talk at x-query.com
Subject: [xquery-talk] 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


More information about the talk mailing list