特定のセクションのみを変更し、残りはそのまま残したい XML があります。これを行うにはどうすればよいですか? つまり、ノード AA2 のみを変更したい
<root>
<parentHeader>
</parentHeader>
<body>
<ChildAA>
<AA1>
<foo>bar</foo>
<foo>bar2</foo>
</AA1>
<AA2>
<foo>bar</foo>
<foo>bar2</foo>
</AA2>
</ChildAA>
<ChildBB>
<BB1>
<foo>bar</foo>
<foo>bar2</foo>
</BB1>
<BB2>
<foo>bar</foo>
<foo>bar2</foo>
</BB2>
</ChildBB>
</body>
</root>
変更されたセクションのみを返す次の XSLT があります。他のすべてを含めるにはどうすればよいですか?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- Whenever you match any node or any attribute -->
<xsl:template match="/*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="AA2">
<RenamedAA2>
<xsl:copy-of select="."/>
</RenamedAA2>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
私は結果としてこのようなものを探しています
<root>
<parentHeader>
</parentHeader>
<body>
<ChildAA>
<AA1>
<foo>bar</foo>
<foo>bar2</foo>
</AA1>
<RenamedAA2>
<foo>bar</foo>
</RenamedAA2>
<RenamedAA2>
<foo>bar2</foo>
</RenamedAA2>
</ChildAA>
<ChildBB>
<BB1>
<foo>bar</foo>
<foo>bar2</foo>
</BB1>
<BB2>
<foo>bar</foo>
<foo>bar2</foo>
</BB2>
</ChildBB>
</body>
</root>