I needed a bit more from xpathgrep than the previous incarnation with its rudimentary command line interface could do, so I took some time out to give it a facelift. It now resembles something that could be used for serious work.
It’s a pity that libxml2 doesn’t provide a way of cleaning up a DOM with redundant namespace declarations. It can only do that while parsing, so right now the lowest-effort way to get there seems to be to serialise the document then reparse it with the
XML_PARSE_NSCLEAN option set. I decided not to add code for that, because, well, if you need it, just pipe to
xmllint --nsclean - which does exactly that.
Anyway, share and enjoy.