]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/papers/use_case/stats/group.xsl
* basic infrastructure for collecting statistics
[helm.git] / helm / papers / use_case / stats / group.xsl
diff --git a/helm/papers/use_case/stats/group.xsl b/helm/papers/use_case/stats/group.xsl
new file mode 100644 (file)
index 0000000..8d25fee
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="cluster" select="50000"/>
+<xsl:param name="upper_limit" select="1200000"/>
+
+<xsl:output method="xml"/>
+
+<xsl:template match="/">
+<groups>
+  <xsl:call-template name="group-by-nodes"/>
+</groups>
+</xsl:template>
+
+<xsl:template name="group-by-nodes">
+  <xsl:param name="base" select="0"/>
+  <xsl:if test="$base &lt;= $upper_limit">
+    <xsl:variable name="count" select="count(//stats[number(elements/total) + number(text-nodes/total) &gt;= $base
+                                                     and number(elements/total) + number(text-nodes/total) &lt; $base + $cluster])"/>
+    <group begin="{$base}" end="{$base + $cluster}">
+      <xsl:value-of select="$count"/>
+    </group>
+    <xsl:call-template name="group-by-nodes">
+      <xsl:with-param name="base" select="$base + $cluster"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+