1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3  <xsl:output encoding="utf-8"/>
4<xsl:template match="/">
5  <summary>
6    <total>
7      <xsl:value-of select="count(//node())"/> nodes,
8      <xsl:value-of select="count(//*)"/> elements,
9      <xsl:value-of select="count(//text())"/> text nodes,
10      <xsl:value-of select="count(//*/@*)"/> attributes.
11    </total>
12
13    <xsl:apply-templates/>
14
15  </summary>
16
17</xsl:template>
18
19
20<xsl:template match="/xsl:stylesheet|/xsl:transform">
21  <analysis>
22    <description>Recognized as xslt stylesheet:</description>
23    <stats>
24      <xsl:value-of select="count(xsl:template)"/> templates,
25      <xsl:value-of select="count(descendant::xsl:variable)"/> variables,
26      <xsl:value-of select="count(descendant::xsl:value-of)"/> value-of's,
27    </stats>
28  </analysis>
29</xsl:template>
30
31<xsl:template match="text()"/>
32
33</xsl:stylesheet>