Link to home
Create AccountLog in
Avatar of geldfeld
geldfeld

asked on

xquery on multiple documents

I am trying to perform an xquery on a folder of xml documents.

How do I do this.

Can I pass a file as a parameter to xquery ( I am using zorba)
or do the following ( which doesnt work):

for $href  in /folder1/folder2/
      for $x in doc ( $href )/task
             return $x/unity
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

The answer likely is in using the collection() function

Saxon and a bunch of other processors I worked with allow this form
for $book in collection("file:///c:/books?select=*.xml ")

Never tried it in Zorba though
Can you try that first?
Avatar of geldfeld
geldfeld

ASKER


Zorba does allow the collection function but I seem to be getting the URL path wrong.

I want to go through the test directory in my current folder. So I did the following:

for $xml in collection("file://test?select=*.xml ")
           for $x in $xml/task
           return  $x/unity 

Open in new window


it throws an "invalid argument"



This query on a single document returns all the children and the childrens children of $x/unity

I just want to show the element names of the immediate children. how do I get it to stop returnign everything?
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.