RE: [xsl] Multiple input files

Subject: RE: [xsl] Multiple input files
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Thu, 25 Sep 2003 09:13:23 -0600
> From: Ricardo Saraiva [mailto:rss@xxxxxxxxxxxxxx]
> Sent: Thursday, September 25, 2003 8:46 AM
> Subject: [xsl] Multiple input files
> My question is how to read all the xml files in one directory as input
> files to my XSL file?

The document() function does not provide for using wildcards to resolve
URIs, so it's not possible to fully automate the process by doing something

<xsl:apply-templates select="document('*.xml')"/>

One solution is to create an XML source document listing all the files you
want to process, then use it as the input for the stylesheet.  Given source
such as:

  <!-- etc. -->

you can do something like this:

<xsl:template match="/file-list">
  <xsl:for-each select="document(file)">
    <!-- do something -->

This is expensive, as it selects the root node (in other words, the entire
document) as the context for each iteration--see the FAQ
( for more ideas on
processing multiple documents.


| brian martinez                           brian.martinez@xxxxxxxxxxx |
| lead gui programmer                                    303.357.3548 |
| cheap tickets, part of trip network                fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400           englewood, co 80111 |
| cendant travel distribution services |

 XSL-List info and archive:

Current Thread