in reply to Replacing an XPath node with the value of its content

Using XML::XSH2, a wrapper around XML::LibXML:
open file.xml ; for //tm mv text() replace . ; save :b ;

Note: Does not work if <tm>'s can be nested.

Update: If <tm> can contain something more than just a text, you have to use the more general "unwrap" method:

for //tm xmv node() replace . ;

Tested with

<tm>a<b>c</b>c<?run test?><!-- comment --></tm>
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Replacing an XPath node with the value of its content
by stylechief (Beadle) on Oct 22, 2013 at 00:03 UTC
    Thanks for the reply. I will look into XML::XSH2, as I am unfamiliar with that module.
    SC