Created
August 24, 2012 12:03
-
-
Save donatasnicequestion/3449847 to your computer and use it in GitHub Desktop.
Count of elements in a document as desribed in http://www.dpawson.co.uk/xsl/sect2/N2018.html#d3308e250
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:key name="gis" match="*" use="name()"/> | |
<xsl:template match="/"> | |
<table> | |
<xsl:apply-templates/> | |
<xsl:message>done reading</xsl:message> | |
<xsl:for-each select="//*[generate-id(.)=generate-id(key('gis',name(.))[1])]"> | |
<xsl:sort select="name()"/> | |
<tr> | |
<td><xsl:value-of select="name(.)"/></td> | |
<td><xsl:value-of select="count(key('gis',name(.)))"/></td> | |
</tr> | |
</xsl:for-each> | |
</table> | |
</xsl:template> | |
<xsl:template match="text()"/> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment