On Wed, 2004-08-11 at 09:27, Karsten Wade wrote: > You can't blindly indent the document and walk away. If you anything in > a <screen> or <programlisting> block that requires specific formatting > (white space, etc.) -- such as code from a program, example from a > config file, or a series of command line examples -- doing a DTD based > indent will likely mess up those sections. If that is not true, I'd be > very happy to see a demonstration. Attached, clean.xsl Works with any docbook file. Note: indent is an implementation option. Saxon does it. I know msxsl doesn't, 'cos it doesn't play fair with ws :-) YMMV -- Regards DaveP. XSLT&Docbook FAQ http://www.dpawson.co.uk/xsl
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:strip-space elements="*"/> <xsl:preserve-space elements="programlisting screen literallayout screenshot computeroutput prompt"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet>