<xsl:stylesheet extension-element-prefixes="saxon" version="1.0">
   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="/">
     <html>
       <body>
         <xsl:apply-templates/>
       </body>
     </html>
   </xsl:template>

   <xsl:template match="*">
     <xsl:param name="level">0</xsl:param>
     <xsl:text>Level: </xsl:text>
     <xsl:value-of select="$level"/>
     <br/>
     <xsl:apply-templates>
       <xsl:with-param name="level">
         <xsl:value-of select="$level+1"/>
       </xsl:with-param>
     </xsl:apply-templates>
   </xsl:template>
 </xsl:stylesheet>