A kind reader added a comment to that post
a few moments ago, and I took the liberty of streamlining his code a bit to produce
this:
<xsl:stylesheet version="1.0" xmlns="http://www./1999/xhtml" xmlns:xsl="http://www./1999/XSL/Transform">
<!--
** XSLT to parse BIND9 XML from the statistics-server (old format)
** inspired by a comment by Andrii Shynkarchuk on
** http:///2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/
**
** Set the view name you're interested in where it says "_default"
** (This could be accessed with an XSLT param or so.)
-->
<xsl:output method="text" />
<xsl:strip-space elements="*"/>
<xsl:template match="isc/bind/statistics">
<xsl:apply-templates select="views/view">
</xsl:apply-templates></xsl:template>
<xsl:template match="views/view">
<xsl:choose>
<xsl:when test="name='_default'">
<xsl:for-each select="zones/zone">
<xsl:value-of select="serial" />
<xsl:text> </xsl:text>
<!-- zone name only (w/o class/view) -->
<xsl:value-of select="substring-before(name, '/')" />
<xsl:text>
</xsl:text> <!-- newline -->
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
If I run the result through xsltproc on a 240MB XML file containing 136,000 zones, I get
results in 8 seconds on my laptop, which is pretty good.
And this works for me for the "newstats" format, introduced experimentally in 9.9.3:
<xsl:stylesheet version="1.0" xmlns="http://www./1999/xhtml" xmlns:xsl="http://www./1999/XSL/Transform">
<!--
** XSLT to parse BIND9 (version3) XML from the statistics-server (new format)
** inspired by a comment by Andrii Shynkarchuk on
** http:///2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/
**
** Set the view name you're interested in where it says "_default"
** (This could be accessed with an XSLT param or so.)
-->
<xsl:output method="text" />
<xsl:strip-space elements="*"/>
<xsl:template match="statistics">
<xsl:apply-templates select="views/view">
</xsl:apply-templates></xsl:template>
<xsl:template match="views/view">
<xsl:for-each select="zones/zone">
<xsl:value-of select="serial" />
<xsl:text> </xsl:text>
<xsl:value-of select="@name" />
<xsl:text>
</xsl:text> <!-- newline -->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>