Merging two XML files using XSLT
Given the following input files:
ApplicationData.xml
<?xml version="1.0" ?>
<ApplicationData>
Whatever data you have in here.
</ApplicationData>
MetricList.xml
<?xml version="1.0" ?>
<MetricList>
Whatever list you have in here.
</MetricList>
AssessmentInput.xml
<?xml version="1.0" ?>
<AssessmentInput />
the following transformation merge.xsl applied to AssessmentInput.xml
<?xml version="1.0" ?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/AssessmentInput">
<xsl:copy>
<xsl:copy-of select="document('ApplicationData.xml')" />
<xsl:copy-of select="document('MetricList.xml')" />
</xsl:copy>
</xsl:template>
</xsl:transform>
produces the correct output of
<?xml version="1.0" encoding="UTF-8"?>
<AssessmentInput>
<ApplicationData>
Whatever data you have in here.
</ApplicationData>
<MetricList>
Whatever list you have in here.
</MetricList>
</AssessmentInput>