[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Multiple input files

Subject: RE: Multiple input files
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Thu, 25 Sep 2003 09:13:23 -0600
input file multiple
> From: Ricardo Saraiva [mailto:rss@xxxxxxxxxxxxxx]
> Sent: Thursday, September 25, 2003 8:46 AM
> Subject:  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
like

<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:

<file-list>
  <file>a.xml</file>
  <file>b.xml</file>
  <!-- etc. -->
</file-list>

you can do something like this:

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

This is expensive, as it selects the root node (in other words, the entire
document) as the context for each iteration--see the FAQ
(http://www.dpawson.co.uk/xsl/sect2/N2602.html#d2874e403) for more ideas on
processing multiple documents.

hth,
b.

| 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   http://www.cheaptickets.com/ |

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.