Question

Has this ever been done before? Is it possible to write an XSLT that will turn an XML document into color-coded, formatted, HTML?

Was it helpful?

OTHER TIPS

XMLSPectrum.xsl (on GitHub) is one of a number of XSLT stylesheets that do this - but this tool is specially for the additional demands of XSLT 2.0.

With XSLT 2.0, much of the programming logic can be within the XPath 2.0 expressions. So the emphasis for this product was the formatting and colorising of XPath - while also ensuring XSLT instructions are rendered properly also. A sample screenshot from a browser:

enter image description here

Because the XSLT input is parsed as text, any existing indentation and line-feeds are preserved by default - even in attributes (the sample had no formatting so the indent option was set). As well as the usual XML formatting, all attributes and their contents are vertically aligned

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top