0 users online. Create an account or sign in to join them.Users

Author:
tarakanoff
Version:
1.0.1
Release Date:
9 Nov 2011
Category:
Date & Time

Description

This template is designed to display the alphabet in the form of links (or whatever you like, decide for yourself). By default, it displays the English alphabet.

The original algorithm is taken from the article "XSLT-examples. Vol.3 Index funds XSLT" (Russian).

XSLT

View Raw
<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>

Discuss this XSLT Utility

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details