in reply to [SOLVED] Moving elements with XML::Twig: Document root closing tag is duplicated on output

Just for comparison, the same task in xsh, a wrapper around XML::LibXML:
open 1155670.xml ; for /shipment/box xmove packing/slip replace . ; xinsert attribute '_TYPE="produce"' into /shipment/slip ; for /shipment/slip[not(following::node()[1][self::text()])] xinsert text {"\n "} after . ; save :b ;

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Moving elements with XML::Twig: Document root closing tag is duplicated on output
by ateague (Monk) on Feb 22, 2016 at 18:45 UTC

    Thanks.

    I will certainly keep that in mind for future projects and experiment with it when I have the time. Always nice to have more tools in my tool belt.