multiple include using wildcard?

L

leapy

Hello

I am looking for ways to programmatically include all XML files from a given
directory into either a "summary" XML file or at XSLT stage. The number of
XML files (actually representing daily orders) present in the directory will
vary.

I have been playing with coding using <xi:include> or <xsl:apply-templates
select="document(@href)/*"/> but am stumped at how to iterate through the
file structure.

Any help *much* appreciated....

L
 
M

Martin Honnen

leapy said:
I am looking for ways to programmatically include all XML files from a
given directory into either a "summary" XML file or at XSLT stage. The
number of XML files (actually representing daily orders) present in the
directory will vary.

Saxon 9 (http://saxon.sourceforge.net/) implements XSLT 2.0 and has
choosen to use the collection function to allow you to pull in all files
from a directory or all files matching a certain pattern (e.g. *.xml).
See http://www.saxonica.com/documentation/sourcedocs/collections.html

So you could use e.g.
<xsl:apply-templates select="collection('someDirectory?select=*.xml')"/>
to process all document nodes or e.g.
<xsl:apply-templates
select="collection('someDirectory?select=*.xml')/root/foo/bar"/>
to process all 'bar' element children of all 'foo' element children of
the 'root' elements of the .xml files in that directory.
 
L

leapy

Martin Honnen said:
Saxon 9 (http://saxon.sourceforge.net/) implements XSLT 2.0 and has
choosen to use the collection function to allow you to pull in all files
from a directory or all files matching a certain pattern (e.g. *.xml).
See http://www.saxonica.com/documentation/sourcedocs/collections.html

So you could use e.g.
<xsl:apply-templates select="collection('someDirectory?select=*.xml')"/>
to process all document nodes or e.g.
<xsl:apply-templates
select="collection('someDirectory?select=*.xml')/root/foo/bar"/>
to process all 'bar' element children of all 'foo' element children of the
'root' elements of the .xml files in that directory.


Wow, Martin.

Many thanks. I will try Saxon immediately.

L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top