I'm not exactly an expert on XML processing, however I did some reading myself, on seeing your question. Here's a post XML::Twig tag conversion similar to yours which has been answered by Michel Rodriguez himself (author of the XML::Twig module). The approach given here would be of help to your question as well.
In reply to Re: Twig Mixed Content Child Text Replace Issues
by ajguitarmaniac
in thread Twig Mixed Content Child Text Replace Issues
by unknown_varmit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |