| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| reindent-html.xsl | 25-Oct-2006 20:51 | 501 | ||
| reindent.xsl | 25-Oct-2006 21:03 | 2.5K | ||
Description: Some producers of XML do a poor job of indenting. For example, as of 2006, Xalan and MSXML are very conservative about how much whitespace they put into serialized XSLT results when xsl:output indent="yes".
The reindent.xsl stylesheet demonstrates how you can use XSLT to properly indent XML, without relying on the processor's built-in indenting capability. This is useful if you are starting with poorly indented XML and want to produce nicely indented XML.
If you instead apply the reindent-html.xsl stylesheet, the output will be HTML with similarly cleaned-up indenting. This is useful if you are starting with poorly indented XHTML and want to produce nicely indented HTML.
Requirements: Any XSLT 1.0 or 2.0 processor should be able to handle this.
See also: other reindenting methods in the XSLT FAQ. (Mine is better than any of them, as far as I can tell).