Created
February 2, 2012 15:07
-
-
Save kardeiz/1723883 to your computer and use it in GitHub Desktop.
xslt for concatenating multiple xml files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Option 1: Use an index XML file to list file names to be combined. Transform that XML file (root: files) with this XSL. --> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="/"> | |
<xml> | |
<xsl:for-each select="files/file"> | |
<xsl:copy-of select="document(.)/xml/*"/> | |
</xsl:for-each> | |
</xml> | |
</xsl:template> | |
</xsl:stylesheet> | |
<!-- Option 2: Name the files to be combined in the XSL --> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="/"> | |
<xml> | |
<xsl:copy-of select="document('filename.xml')/xml/*"/> | |
<!-- Use a scripting language that can manipulate XML to append child nodes here listing all the files to be combined --> | |
</xml> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment