<xsl:stylesheet

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"

>



<xsl:output omit-xml-declaration="yes"/>



<xsl:template match="/">

    <pre>

    <xsl:apply-templates mode="copy" select="*"/>

    </pre>

</xsl:template>



<xsl:template match="*" mode="copy"><xsl:variable name="content" select="string-length(.)>0 or count(*)>0"/>&lt;<xsl:value-of select="name()"/><xsl:for-each select="@*"><xsl:text>

        </xsl:text><xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:for-each><xsl:if test="$content">></xsl:if><xsl:if test="not($content)">/></xsl:if><xsl:apply-templates select="* | text() | node()" mode="copy"/><xsl:if test="$content">&lt;/<xsl:value-of select="name()"/>></xsl:if></xsl:template>



<xsl:template match="text()" mode="copy">

  <xsl:value-of select="."/>

</xsl:template>



<xsl:template match="comment()" mode="copy">&lt;--<xsl:value-of select="."/>--></xsl:template>



</xsl:stylesheet>

