I would like to merge two xml files into one using xslt.
file1:
<cut> <content1> .... </content1> </cut>
file1:
<cut> <content2> .... </content2> </cut>
merged:
<cut>
<content1> ... </content1>
<content2> ... </content2>
</cut>
I would like to pass parameters to the xslt containing the files to merge.
xsltproc.exe" --stringparam file1 s:\file1.xml --stringparam file2 s:\file2.xml s:\merge.xslt
merge.xslt:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="file1"/>
<xsl:param name="file2"/>
<xsl:variable name="big-doc-rtf">
<xsl:copy-of select="document($file1)"/>
<xsl:copy-of select="document($file2)"/>
</xsl:variable>
<xsl:variable name="big-doc" select="exsl:node-set($big-doc-rtf)"/>
<xsl:template match="/">
<cut>
<xsl:apply-templates select="$big-doc/cut/*"/>
</cut>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|text()|comment()|processing-instruction()">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
I only get an empty "cut" tag. What is wrong?