home *** CD-ROM | disk | FTP | other *** search
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" encoding="UTF-8" />
- <xsl:variable name="indent" select="1" />
- <xsl:variable name="spaces" select="' '"/>
- <xsl:template match="*">
- <xsl:variable name="varspaces" select="substring($spaces, 1, count(ancestor::node()) * $indent)"/>
- <xsl:value-of select="$varspaces"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:choose>
- <xsl:when test="*">
- <xsl:apply-templates/>
- <xsl:value-of select="concat('
', $varspaces)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="normalize-space()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="NOTE">
- <xsl:copy>
- <xsl:value-of select="."/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="comment()|processing-instruction()">
- <xsl:copy/>
- </xsl:template>
- </xsl:stylesheet>
-