|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Inserting parts of a xml document
Hi.
I have the following two xml files: test1.xml
<root>
<a>
<b>
<name>node1</name>
<option>true</option>
</b>
</a>
</root>test2.xml
<root>
<a>
<b>
<name>node2</name>
<option>false</option>
</b>
</a>
</root>The result should be:
<root>
<a>
<b>
<name>node1</name>
<option>true</option>
</b>
<b>
<name>node2</name>
<option>false</option>
</b>
</a>
</root>I simply want to insert test2.xml/root/a/* into test1.xml/root/a. So I wrote the following xslt: <xsl:template match="/">
<xsl:apply-templates />
</xsl:template> <xsl:template match="root/a">
<xsl:apply-templates />
<xsl:copy>
<xsl:apply-templates select="document('test2.xml')/root/a/node()" />
</xsl:copy>
</xsl:template> <!-- copy all significant parts -->
<xsl:template match="node()|attribute::*">
<xsl:copy>
<xsl:apply-templates select="node()|attribute::*" />
</xsl:copy>
</xsl:template>But with this xslt the "<a>" and "</a>" are just around the second "<b>":
<root>
<b>
[data of "node1"]
</b>
<a>
<b>
[data of "node2"]
</b>
</a>
</root>What do I have to change in my xslt file to get the correct result?? Martin XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








