Хлебные крошки HostCMS отдельный показ последнюю позицию в XSL

Бывает так что хочется в XSL отдельно показать последнюю позицию элемента в хлебных крошках. Для этого необходимо изменить XSL: ХлебныеКрошки

<xsl:template match="/site">
    <xsl:if test="count(*[@id][link != '/'])">
        <div class="h1"><xsl:value-of select="//*[@id][link/node() or url/node()][not(child::*[link/node() or url/node()])]/name"/> </div>
        <ul class="breadcrumbs" itemscope="itemscope" itemtype="http://schema.org/BreadcrumbList">
            <li class="home" itemprop="itemListElement" itemscope="itemscope" itemtype="http://schema.org/ListItem">
                <a href="/" class="home" title="Главная" itemprop="item"><span itemprop="name">Главная</span></a>
                <meta itemprop="position" content="1" />
            </li>
            <xsl:apply-templates select="*[@id][link != '/']" />
        </ul>
    </xsl:if>
</xsl:template>

<xsl:template match="*">
<xsl:variable name="link">
    <xsl:choose>
        <!-- Если внутренняя ссылка -->
        <xsl:when test="link != ''">
            <xsl:value-of disable-output-escaping="yes" select="link"/>
        </xsl:when>
        <!-- External link -->
        <xsl:otherwise>
            <xsl:value-of disable-output-escaping="yes" select="url"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

<!-- Показывать ссылку? -->
<xsl:choose>
    <xsl:when test="(show = 1 or active/node() and active = 1) and count(*[@id][link/node() or url/node()]) &gt; 0">
        <li itemprop="itemListElement" itemscope="itemscope" itemtype="http://schema.org/ListItem">
            <a itemprop="item" title="{name}" href="{$link}">
                <span itemprop="name"><xsl:value-of select="name"/></span>
            </a>
            <meta itemprop="position" content="{count(ancestor::*) + 1}" />
        </li>
    </xsl:when>
    <xsl:otherwise>
        <li class="current-item"><xsl:value-of select="name"/></li>
    </xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*[@id][link/node() or url/node()]" />
</xsl:template>

Тут видно что последняя позиция в крошках будет отдельно показан в блоке

<div class="h1"></div>
  • 3 736 просмотров