This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: multiple XML and wildcards
- To: xsl-list at mulberrytech dot com
- Subject: Re: multiple XML and wildcards
- From: Mike Brown <mike at skew dot org>
- Date: Mon, 19 Jun 2000 11:23:26 -0600 (MDT)
- Reply-To: xsl-list at mulberrytech dot com
> <xsl:apply-templates select="document('test.xml')//driver/meta"><xsl:sort
> select="./title"/></xsl:apply-templates>
>
> What if I have a huge collection of XML files.
> I certainly do not want to type in all these names in an construction like
> the above one.
> I would like to use some sort of wildcard.
You can't. The document() function can take a list of filenames by way of
string values of nodes in a node-set passed in as the first argument,
though. So you could put the file list in XML...
<?xml version="1.0"?>
<!-- filelist.xml -->
<filelist>
<file>test1.xml</file>
<file>test2.xml</file>
<file>test3.xml</file>
</filelist>
...and reference the file elements in it...
<xsl:variable name="files" select="document('filelist.xml')/filelist/file"/>
...then let document() pick out the string values and return the unified
node-set of all the documents in the list. You can do with the node-set
as you please..
<xsl:apply-templates select="document($files)">
<xsl:sort select="title"/>
</xsl:apply-templates>
But there's no way to do file globbing, as I think it's called.
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://www.skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list