Re: [xsl] Transforming multiple XML files into one file

Subject: Re: [xsl] Transforming multiple XML files into one file
From: Chad Chelius <cchelius@xxxxxxxxxxxxxxx>
Date: Mon, 3 Jul 2006 08:48:25 -0400
David,
Sorry for not being clearer about this in the beginning. What I have is several separate XML files. We'll call them file1.xml, file2.xml, and file3.xml. What I want to do is take the <story> element from each one of those files and generate one big xml file on output that combines those elements. How would I do something like that?


chad

On Jun 21, 2006, at 5:27 AM, David Carlisle wrote:

not sure what you mean but if you have  a file
<files>
 <z>one.xml</z>
 <z>two.xml</z>
 <z>three.xml</z>
</files>

and go

<xsl:variable name="files" select="document(document('files.xml')/ files/z)"/>

then $files is a node set of three document nodes representing one.xml
two.xml and three.xml and you can apply
templates to all three at once with
<xsl:apply-templates select="$files"/>
or extract elements from all three documents with
xsl:for-each select="$files/some/path/to/here"

David

Current Thread