Skip to content

Instantly share code, notes, and snippets.

@ewg118
Created February 26, 2015 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewg118/6b0b99d953ae1f4d8eaf to your computer and use it in GitHub Desktop.
Save ewg118/6b0b99d953ae1f4d8eaf to your computer and use it in GitHub Desktop.
count tags
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:for-each select="descendant::*:fsDecl">
<xsl:variable name="id" select="@xml:id"/>
<xsl:value-of select="*:fsDescr"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="count(ancestor::*:TEI/descendant::*:fs[@type=$id])"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment