Thank you, this is really helpful. I have two questions about the code.
First of all:
Is there a way to say find the content that ISN'T baz? Is there a neq, basically?
Secondly, is there any quick way through LibXML to print back into an XML file, or do I just need to use normal perl file output for that?