+++ /dev/null
-<?xml version="1.0"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-<xsl:param name="URI" select="''"/>
-
-<xsl:output method="xml"/>
-
-<xsl:template match="/">
-<stats for="{$URI}">
- <xsl:message>Computing max depth...</xsl:message>
- <max-depth>
- <xsl:call-template name="max-depth2"/>
- </max-depth>
- <xsl:message>Computing number of nodes...</xsl:message>
- <number-of-elements>
- <xsl:call-template name="number-of-elements"/>
- </number-of-elements>
- <number-of-text-nodes>
- <xsl:call-template name="number-of-text-nodes"/>
- </number-of-text-nodes>
- <number-of-blank-text-nodes>
- <xsl:call-template name="number-of-blank-text-nodes"/>
- </number-of-blank-text-nodes>
- <xsl:message>Computing number of leaves...</xsl:message>
- <number-of-leaves>
- <xsl:call-template name="number-of-leaves"/>
- </number-of-leaves>
-</stats>
-</xsl:template>
-
-<xsl:template name="number-of-elements">
- <xsl:value-of select="count(//*)"/>
-</xsl:template>
-
-<xsl:template name="number-of-text-nodes">
- <xsl:value-of select="count(//text())"/>
-</xsl:template>
-
-<xsl:template name="number-of-blank-text-nodes">
- <xsl:value-of select="count(//text()[normalize-space(.) = ''])"/>
-</xsl:template>
-
-<xsl:template name="number-of-leaves">
- <xsl:value-of select="count(//text()|//*[not(child::node())])"/>
-</xsl:template>
-
-<xsl:template name="max-depth-aux">
- <xsl:param name="nodes" select="/.."/>
- <xsl:param name="depth" select="0"/>
- <xsl:param name="DEPTH" select="0"/>
- <xsl:choose>
- <xsl:when test="$nodes">
- <xsl:variable name="head-depth">
- <xsl:call-template name="max-depth-aux">
- <xsl:with-param name="nodes" select="$nodes[1]/*"/>
- <xsl:with-param name="depth" select="$depth + 1"/>
- <xsl:with-param name="DEPTH" select="$DEPTH"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="NEW_DEPTH">
- <xsl:choose>
- <xsl:when test="$head-depth > $DEPTH">
- <xsl:value-of select="$head-depth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$DEPTH"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="max-depth-aux">
- <xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="DEPTH" select="$NEW_DEPTH"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$depth > $DEPTH">
- <xsl:value-of select="$depth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$DEPTH"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="max-depth">
- <xsl:call-template name="max-depth-aux">
- <xsl:with-param name="nodes" select="//node()"/>
- </xsl:call-template>
-</xsl:template>
-
-<xsl:template name="max-depth2-aux">
- <xsl:param name="nodes" select="/.."/>
- <xsl:param name="DEPTH" select="0"/>
- <xsl:choose>
- <xsl:when test="$nodes">
- <xsl:variable name="depth" select="count($nodes[1]/ancestor::*)"/>
- <xsl:variable name="NEW_DEPTH">
- <xsl:choose>
- <xsl:when test="$depth > $DEPTH">
- <xsl:value-of select="$depth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$DEPTH"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="max-depth2-aux">
- <xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
- <xsl:with-param name="DEPTH" select="$NEW_DEPTH"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$DEPTH"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="max-depth2">
- <xsl:call-template name="max-depth2-aux">
- <xsl:with-param name="nodes" select="//node()[not(child::node())]"/>
- </xsl:call-template>
-</xsl:template>
-
-</xsl:stylesheet>
-