Skip to content
Phil Fearon edited this page May 18, 2014 · 29 revisions

The XMLSpectrum project was started with the primary goal of providing syntax-highlighting for XPath-family source code (XSLT, XQuery etc.) and leave the formatting exactly as in the source. However, when testing XMLSpectrum against many XSLT samples in the public domain, a significant number of formatting issues were found in the original source.

Issues in code formatting can severely impact the readability of the code - to the extent where syntax-highlighting becomes largely irrelevant. This is why a significant number of XML/XSLT formatting features are included in XMLSpectrum - along with the option to preserve the original formatting 'as-is'.

This page summarises the XSLT parameters used to control formatting of XML/XSLT by showing screenshots of the source code before and after reformatting/syntax-highlighting.

auto-trim off

XSLT Parameter: auto-trim=no no formatting The above screenshot shows the highlighted result with auto-trim set to off. Note that to ensure the original formatting is kept intact, we need all of the following settings:

  • XSLT Parameter: auto-trim=no
  • XSLT Parameter: format-mixed-content=no
  • XSLT Parameter: indent=-1
  • XSLT Parameter: auto-trim=no

The following settings are also required if the XSLT is not well formed (e.g. namespace declarations are missing). XSLT Parameter: document-type=xslt XSLT Parameter: document-type-prefix=xsl (in this case it is inferred because it is on the first element)

auto-trim on

XSLT Parameter: auto-trim=no no formatting

color-theme css-inline css-path document-type document-type-prefix font-name format-mixed-content indent link-names output-method output-path sourcepath w3c-xpath-functions-uri

Clone this wiki locally