Created
May 10, 2012 14:40
-
-
Save xpathr/2653486 to your computer and use it in GitHub Desktop.
Alphabet by tarakanoff
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 version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template name="alphabet"> | |
<!-- en --> | |
<xsl:param name="s" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> | |
<xsl:variable name="a"> | |
<xsl:value-of select="substring($s,1,1)"/> | |
</xsl:variable> | |
<xsl:variable name="s0"> | |
<xsl:value-of select="substring-after($s,$a)"/> | |
</xsl:variable> | |
<xsl:if test="$s != ''"> | |
<xsl:call-template name="alphabet-item"> | |
<xsl:with-param name="a" select="$a"/> | |
</xsl:call-template> | |
<xsl:call-template name="alphabet"> | |
<xsl:with-param name="s" select="$s0"/> | |
</xsl:call-template> | |
</xsl:if> | |
</xsl:template> | |
<xsl:template name="alphabet-item"> | |
<!-- copy this template to your page XSL, then modify it to change the default display behaviour --> | |
<xsl:param name="a" select="''" /> | |
<a href="#{$a}"><xsl:value-of select="$a"/></a> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment