Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Which module should I use for transforming an XML document to another XML document? i.e a field in the first document is differently named in the second document, or it can have extra attributes etc

Is that a job for XSLT? The examples I've seen transform from XML to HTML etc but not from XML to XML

Replies are listed 'Best First'.
Re: transform XML to XML
by Corion (Patriarch) on May 22, 2015 at 09:31 UTC

    XML::Twig is geared for converting XML to a different XML document, and there also is XML::Rules (which I haven't used).

    You can use XSLT, but personally I found that XSLT becomes a giant hassle when the structures of two documents wildly differ and you need to "remember" information for later use, something which is trivial in Perl.

Re: transform XML to XML
by choroba (Cardinal) on May 22, 2015 at 09:35 UTC
    I often use XML::XSH2, a wrapper around XML::LibXML, but maybe it's just me.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ