Hi everyone, perhaps the other heavy xmlstarlet users are also interested in this, so I decided to share.
I wrote an LD_PRELOADable library (sorry, Macintosh users) that can be used to make xmlstarlet fo/sel output a space before the “/>” as is needed for XHTML. https://mbsd.evolvis.org/cvs.cgi/contrib/hosted/tg/forceXHTML.c?rev=HEAD This was not entirely simple as many useful functions for minimal change are not exposed by the API; “fo” is a tad more fragile than “sel” but I tested both on a small corpus and diff’d against the normal results, but I don’t have PIs or anything else fancy in there. I tested these on Debian GNU/Linux 11 (“bullseye”). These might even work with other tools (xmllint/xsltproc) but I don’t use them, only xmlstarlet, have “always” been. Maybe drop me a note if you enjoy it, have patches or suggestions. bye, //mirabilos -- „Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.“ -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: “[…]uhr.gz is a reason to install mksh on every system.”)