I of course have no way to know just how big or how small your actual requirement may be, but I would point out that the XML industry standard, XSLT, essentially exists to allow the specification of XML transformations without writing custom-code to do it. So, if you find that you can generalize your big-picture requirement into something that XSLT can take care of for you, it just might be an approach worth looking into. (PerlMonks apparently won’t allow me to include a direct reference to the WikiPedia article.)
Of course I see that you are already using XML::LibXML, which leverages the venerable binary libxml2, thus giving you instant access to the definitive implementation of XSLT should it prove advantageous in this particular project.
Whether this will turn out to be “a viable approach, thanks for suggesting it,” or “overkill,” is only for you to decide. For one-off cases it is probably overkill – so, ignore this comment – but if you have a lot of transformations to make it can be a very big win. The very nice thing about Perl is that it gives you very easy access to either alternative – and with the power to back it up.