XML Pretty Printer Missing 2 Key Edge Cases
- by viatropos
Using this xslt file found on this blog to pretty print xml using Nokogiri, everything almost works, but to the point where I can't use it for HTML.
First, if a node is empty, it turns it into a self closing node, so:
<textarea></textarea>
gets converted to
<textarea/>
But that messes up the html tree when rendered.
Second, if the node just has text, the text isn't tabbed, and the closing node isn't tabbed, so:
<li>
<label>some text</label>
</li>
becomes:
<li>
<label>some text
</label>
</li>
...but it would ideally be:
<li>
<label>
some text
</label>
</li>
Does anyone who's pro at XSLT know a quick fix for this?