[xquery-talk] How to run xquery dynamically on file listing from
kevin at kevingrover.net
Thu Apr 10 19:00:44 PDT 2008
On Thu, Apr 10, 2008 at 11:22 AM, <seleneplatt at comcast.net> wrote:
> I'm a complete newbie at xquery and am trying to execute a query dynamically on
> all files in a given directory, rather than hardcoding a particular file into
> the 'doc()' call. I've tried using 'collection()' but am unclear as to how to
> get it to work.
> I did see this thread on x-query.com:
> [xquery-talk] Query Through Multiple Files
> but the closest anyone came to the answer I was hoping to find was to hardcode a
> *list* of files to traverse.
> 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.
I feel for you on this. It's taken me weeks to figure anything out.
The crux if it is that the 'collection()' function is implementation
I've been trying with saxon for a long while and could not find any
documentation or examples. After many attempts at searching (Google),
and some dumb luck (I searched the main saxon documentation toc for
collection), I found saxon's documentation page:
Still, no examples, but better. From that page, I think I can
probably get my stuff going. What I wanted to do at the time was more
of a small itch than and real need, so I tended to look into it
somewhat shallowly and sporadialy.
NOTE: I was stuck with a non Internet connected machine, so I had to
search later, from other machines. I tried downloading the saxon
documentation, but all seemed incomplete. I grabbed saxon9, and just
recently grabbed it's doc distro, but have not tried to search it for
this. Maybe I will. I would (personally) like to see the Saxon
Documentation rendered into many forms (PDF, HTML, CHM) from something
like DocBook. It would also be _very_ helpful if there were more
examples. I've been meaning to ask if I could help do this (at least
to convert the HTML documentation tree to DocBook), but never got
around to it.
If you're using an all-in-one editor, you'll have to dig into it to
see what back end they use. I believe oXygen XML uses Saxon (but I'm
This is one of those things that seems sort of simple when I find the
answer, but was completely baffling beforehand - particularly since I
could not seem to find anything online.
More information about the talk