XSL шаблон, который выводит бренды из модуля интернет-магазина, разделяя их по алфавиту
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hostcms="http://www.hostcms.ru/"
exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<xsl:key name="a" match="shop_producer" use="substring(name, 1, 1)" />
<!-- МагазинСписокПроизводителей -->
<xsl:template match="/">
<section id="produsers">
<xsl:apply-templates select="shop"/>
</section>
</xsl:template>
<xsl:template match="shop">
<div class="top">
<h1>Бренды</h1>
</div>
<xsl:if test="count(shop_producer) = 0">
<div id="error">Производители не найдены!</div>
</xsl:if>
<div class="block3" style="padding: 5px 0 12px 5px;">
<div class="row">
<ul>
<xsl:apply-templates select="shop_producer" mode="alphabet">
<xsl:sort select="name" order="ascending"/>
</xsl:apply-templates>
</ul>
</div>
<!--xsl:apply-templates select="shop_producer">
<xsl:sort select="name" order="ascending"/>
</xsl:apply-templates-->
</div>
</xsl:template>
<xsl:template match="shop_producer" mode="alphabet">
<xsl:variable name="a" select="substring(name,1,1)"/>
<xsl:if test="not(preceding-sibling::shop_producer[starts-with(name, $a)][1])">
<li class="col-xs-12">
<h4><xsl:value-of select="$a"/></h4>
<div class="row">
<ul>
<xsl:for-each select="/shop/shop_producer">
<xsl:variable name="name" select="substring(name,1,1)"/>
<xsl:if test="$a = $name">
<li class="col-xs-6 col-sm-4 col-md-3 match-height"><a class="producer" href="{/shop/url}producer-{@id}/"><xsl:value-of disable-output-escaping="no" select="name"/></a></li>
</xsl:if>
</xsl:for-each>
</ul>
</div>
</li>
</xsl:if>
</xsl:template>
<xsl:template match="shop_producer">
<a class="producer" href="{/shop/url}producers/{path}/"><xsl:value-of disable-output-escaping="no" select="name"/></a>
</xsl:template>
</xsl:stylesheet>