i have two xml files:
<m2>
<header>
<to>ggg</to>
<from>aaa</from>
<id>11</id>
<name>gd</name>
<mtype>me</mtype>
</header>
<body>some text</body>
</m2>
2.
<m2>
<header>
<desc>
<to>ggg</to>
<from>aaa</from>
</desc>
<id>11</id>
<name>gd</name>
<mtype>nothing</mtype>
</header>
<body>some text</body>
</m2>
what is the xslt file that convert from the first xml to the second xml?
the xslt need to transform the value of the mtype from “me” to “some text”
and insert the “to” and “from” elements into the “desc” element.
This transformation:
when applied o the provided XML document, restored from the picture ( Never do this again!):
produces the wanted result:
Explanation: Simple application of the identity rule design pattern. Using and overriding the identity template is the most fundamental and powerful XSLT design pattern.
See examples and explanations at: http://dpawson.co.uk/xsl/sect2/identity.html