Search code examples
xslt-2.0xpath-2.0

XPath2 :How to access all documents in a folder?


XSLT2/Xpath2 allow you to open a document using the document() or doc() functions, but you have to specify the filename.

Is there a way to open all the documents in a given file folder without knowing their filenames (and without a lookup table or master document)? Perhaps using wildcards?

For example, it would be nice to do something like

...

to process all the documents in the current directory without necessarily knowing what they are. Is there some way to do this?


Solution

  • Well document and doc allow you to process XML documents. And XSLT 2.0 processors like Saxon 9 allow you to use the collection function to pull in all XML documents in a certain directory, see http://www.saxonica.com/documentation/sourcedocs/collections.xml.

    AltovaXML also allows you to pull in certain documents in a folder or directory with the collection function: http://manual.altova.com/AltovaXML/altovaxmlcommunity/index.html?fnfunctionssupport.htm