Refer the attached SVG image for sample, after formatting(--indent-spaces 2) notice that:
metadata, rdf:RDF, cc:Work, dc:format, dc:type, defs, and sodipodi:nameview elements are not separated to individual lines.<g>, <path />, </g>, and </svg> elements are all on the same line.It appears that the formatting is broken in a degree, which matches the result of http://xmlbeautifier.com/ but not https://codebeautify.org/xmlvalidator, which seems to use a different algorithm.
The output of
xmllint --formatalso seems to be broken as well, so it might be a libxml issue.People at libxml2 informed me that this is due to the
xml:space="preserve"attribute in the SVG file, after removing the attribute xmlstarlet works as expected.Okay, sounds like it's working as intended, closing the bug.