Thanks Tom, i'm trying to use your solution, but that code works for an element inside the header right? In my case, the whole header may not be present (<header>...<header>) at all, for example, could be like this:
<Envelope>
<Body>
...
</Body>
</Envelope>
So, the result message after the transformation is:
<Envelope>
<Body>
...
</Body>
<Header>
...
</Header>
</Envelope>
Because the "add" directive locates the element at the end of the selector (Envelope in this case)
Is it possible to modify a little bit your solution to make it works for my particular scenario?
Thank you very much.