Example xml is:
<a amp="a"><b><c>this is the text</c></b></a>
Needs to be transformed to:
<a amp="a"><c>this is the text</c></a>
Example xml is:
<a amp="a"><b><c>this is the text</c></b></a>
Needs to be transformed to:
<a amp="a"><c>this is the text</c></a>
Apply the template on
<c>
and then just use a copy design pattern.Solution #1: A slight improvement to smaccoun's solution that would preserve any attributes on the
c
element (not necessary for example XML):Solution #2 Another alternative that leverages the built-in template rules, which apply-templates for all elements and copy all
text()
:Solution #3: A modified identity transform:
Solution #4 If you know what you want, just copy it from a match on the root node
If you want to simply remove the
<b>
element from your input, then a modified identity transform should be used with a template matching the<b>
element that simply applies templates to it's children.