+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:box="http://helm.cs.unibo.it/2003/BoxML"
+>
+
+<xsl:param name="size_min" select="1"/>
+<xsl:param name="size_max" select="200"/>
+<xsl:param name="perc" select="0.03"/>
+<xsl:param name="step" select="10"/>
+
+<xsl:template match="/">
+ <html>
+ <body>
+ <xsl:call-template name="find-dep"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template name="find-dep">
+ <xsl:param name="size" select="$size_min"/>
+ <xsl:variable name="range" select="$size * $perc"/>
+ <xsl:if test="$size <= $size_max">
+ <table border="1">
+ <tr>
+ <th>N</th>
+ <th>Size (bytes)</th>
+ <th>Elements</th>
+ <th>Max depth</th>
+ <!--
+ <th>Text nodes</th>
+ <th>Total nodes</th>
+ <th>Leaf avg</th>
+ <th>Max width</th>
+ <th>Inner avg width</th>
+ <th>Max attributes</th>
+ <th>Total attributes</th>
+ -->
+ <th>Object</th>
+ </tr>
+ <xsl:apply-templates select="statistics/stats[number(depth/max) >= $size - $range
+ and number(depth/max) <= $size + $range]">
+ <xsl:sort order="ascending" data-type="number" select="number(elements/total)"/>
+ </xsl:apply-templates>
+ </table>
+ <xsl:call-template name="find-dep">
+ <xsl:with-param name="size" select="$size + $step"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="stats">
+ <tr>
+ <td align="left">
+ <xsl:value-of select="position()"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="size"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="number(elements/total)"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="depth/max"/>
+ </td>
+ <!--
+ <td align="left">
+ <xsl:value-of select="number(text-nodes/total)"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="round(depth/leaf-avg)"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="width/max"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="round(width/inner-avg)"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="attributes/max"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="attributes/total"/>
+ </td>
+ -->
+ <th align="left">
+ <xsl:value-of select="substring(@for,21)"/>
+ </th>
+ </tr>
+</xsl:template>
+
+</xsl:stylesheet>
+