I am using this input xml file .
<Content>
<body><text>xxx</text></body>
<body><text>yy</text></body>
<body><text>zz</text></body>
<body><text>kk</text></body>
<body><text>mmm</text></body>
</Content>
after Xslt transformation the output should be
<Content>
<body><text>xxx</text>
<text>yy</text>
<text>zz</text>
<text>kk</text>
<text>mmm</text></body>
</Content>
Can anyone please provide its relavant Xsl file.
This complete transformation:
when applied on the provided XML document:
produces the wanted, correct result:
Explanation:
The identity rule copies every node "as-is".
It is overriden by two templates. The first ignores/deletes every
body
element`.The second template overriding the identity template also overrides the first such template (that deletes every
body
element) for anybody
element that is the firstbody
child of its parent. For this firstbody
child only, abody
element is generated and in its body all nodes that are children nodes of anybody
child of its parent (the currentbody
elements and all of itsbody
siblings) are processed.