我想使用Xslt
将XML文件内容添加到另一个XML文件中我们怎么做?
答案 0 :(得分:2)
使用document()
函数加载其他XML文档。如果您只想在输出树中逐字插入第二个文档的内容,可以使用
<xsl:copy-of select="document('otherfile.xml')/*" />
答案 1 :(得分:2)
要添加到Ian Roberts的回答中,如果要将第二个文档作为最外层元素的最后一个子项插入,请执行以下操作“:
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="@*, node()"/>
<xsl:copy-of select="document('otherfile.xml')"/>
</xsl:copy>
</xsl:template>