[xquery-talk] How to run xquery dynamically on file listing fromdirectory

Vinh Vu ngontro86 at yahoo.com
Thu Apr 10 21:10:43 PDT 2008

What I am doing and still try to implement is parse this directory into a set of xml file like: from a very big file: bigfile.xml, now you create a set of xml file ranging from 0.xml to n.xml. Using a for loop now, you can read it one by one. one more good thing is that, by using a hashtable during parsing, you can  make your algorithm run faster.


Michael Kay <mike at saxonica.com> wrote: 
>Is there anyway to do something like:
    for $x in collection("xmlfiles")
where 'xmlfiles' is a subdirectory containing the actual xml files I want to

use?  I would need to know the exact syntax, as this is all new to me.

As others have said, the interpretation of the URI passed to collection() is
very much processor-dependent. Altova have their own XQuery processor, and I
would imagine it treats collection() in the same way as their XSLT
processor: in their 2007 product that's effectively a null implementation,
in the 2008 version it does roughly the same as Saxon: you can either
specify a directory name, or the name of an XML file that acts as a catalog
of the collection. IIRC, they don't provide the ability to filter the
contents of the directory.

Michael Kay

talk at x-query.com

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20080410/16ca613c/attachment-0001.htm

More information about the talk mailing list