Hi Christian, 

that's perfect, thank you very much. Also, thank you for the File Module example -- beyond some reading I hadn't started to explore its uses.

Cheers,
Bridger

On Sun, Jan 31, 2016 at 7:28 AM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Bridger,

> fn:collection("/usr/home/bridger/Documents/foo/bar/?select=*.xml;recurse=yes")/t:TEI

As far as I know, the "recurse" option is Saxon-Specific. But by
default, all XML files in the directory and its sub-directories will
be recursed. Have you tried to use fn:collction as follows?

  fn:collection("/usr/home/bridger/Documents/foo/bar/")

Another, more flexible alternative is to use the File Module (which,
by the way, is also supported by Saxon):

  let $root :="/usr/home/bridger/Documents/foo/bar/"
  for $file in file:list($root, true(), "*.xml")
  return fn:doc($root || $file)

Hope this helps,
Christian



> let $title := fn:data($ready/t:teiHeader/t:fileDesc/t:titleStmt/t:title)
> return $title
>
> The structure under bar/ looks something like
> bar/
>   001/
>     001.xml
>   002/
>     002.xml
>   003/
>     003.xml
>   ...
>   ...
>   009/
>     009.xml
>
> Does BaseX's fn:collection() allow for recursion into a directory structure
> like this with the /?select syntax options or should I use a combination of
> functions from the File Module to move through these directories?
>
> Note: I'm not pulling these files into a database, rather I'm just using
> BaseX as a query processor.
>
> Thanks for your time.
> Best,
> Bridger
>