There are many XML modules on CPAN.
It might be even easier if you seperate this into two steps:
First read the XML into a hash (for example via http://search.cpan.org/~msergeant/XML-Parser-2.36/Parser.pm)
Walk through the hash, because it's a Perl native data structure which should be easy to convert or to build a new hash from.
Now write your new hash to disk. I didn't ever do this using a module, but there should be some on CPAN.