in reply to Re^6: LibXML setNodeName error
in thread LibXML setNodeName error

Well, in that case perhaps add next unless $el->getAttribute('name')=~/^\w+$/; into the loop I showed, or, since that might reject valid element names, reject the unwanted names with next if $el->getAttribute('name')=~/[\{\}]/;, adding more there as necessary.

(Looking back at the original problem statement, I do have to say I'm not sure why you want to manipulate your XSL like this in the first place. XML and especially XSL is somewhat verbose in its nature...)

Replies are listed 'Best First'.
Re^8: LibXML setNodeName error
by Anonymous Monk on Jun 27, 2017 at 14:53 UTC
    Perfect! One last request, if that's okay. How do I print to a file instead of the console? I hope this isn't too difficult to solve. I'm currently trying it myself. I will comment as soon as I have it figured out.

      A thorough read of XML-LibXML is probably in order - long, I know, but that's the best way to learn about all the possibilities that are offered :-)

      In this case, have a look at ->toFile in XML::LibXML::Document.

        Resolved! The reading is very dense. I quickly found:
        my $file = 'output.xsl'; open my $out_fh, '>', $file; print {$out_fh} $doc->toString;
        Thank you for all your help and your patience. I'm glad to be a new member of this community, and I promise to give back in the future just as you have given to me.