gold holk - 2021-09-18

It is good to have namespace for xml, but specify namespace in xpath is troublesome. In xslt 2.0, one can specify default namespace for xpath, but libxml2 does not support xslt 2.0.
In xmlstarlet, one can use --doc-namespace, and _ will refer to the default namespace, but it is still troublesome to write every element with prefix.
This patch add a --ignore-default-namespace option, which work in xml select and xml edit. This option will remove default namespace in xml tree, so xpath without prefix can match. Since I does not remove xmlns attribute, the output xml will still has default xmlns definition.
I am not very familiar with C and libxml2, so my code may seem to be strange.
Please find the patch in the attachment.

 

Last edit: gold holk 2021-09-18