Всем привет!
В новостях есть нумерация страниц 1 2 3 и т.д
Мне нужно добавить кнопки "В начало" и "В конец".
Нашла в документации такое
<xsl:template match="udata[not(tobegin_link) and toend_link]" mode="paging.words">
<div class="paging-words">
<a>« В начало</a>
<a>« Предыдущая</a>
|
<a class="active" href="{tonext_link}">Следующая »</a>
<a class="active" href="{toend_link}">В конец »</a>
</div>
</xsl:template>
<xsl:template match="udata[tobegin_link and toend_link]" mode="paging.words">
<div class="paging-words">
<a class="active" href="{tobegin_link}">« В начало</a>
<a class="active" href="{toprev_link}">« Предыдущая</a>
|
<a class="active" href="{tonext_link}">Следующая »</a>
<a class="active" href="{toend_link}">В конец »</a>
</div>
</xsl:template>
<xsl:template match="udata[tobegin_link and not(toend_link)]" mode="paging.words">
<div class="paging-words">
<a class="active" href="{tobegin_link}">« В начало</a>
<a class="active" href="{toprev_link}">« Предыдущая</a>
|
<a>Следующая »</a>
<a>В конец »</a>
</div>
</xsl:template>
Но в своем шаблоне применить не получается(
Мой Модуль numpages.xsl
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "ulang://i18n/constants.dtd:file">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="total" />
<xsl:template match="total[. > ../per_page]">
<xsl:apply-templates select="document(concat('udata://system/numpages/', ., '/', ../per_page))" />
</xsl:template>
<xsl:template match="udata[@method = 'numpages']" />
<xsl:template match="udata[@method = 'numpages'][count(items)]">
<div class="paging">
<xsl:apply-templates select="items/item" mode="numpages" />
<xsl:templates select="items/item" mode="paging" />
</div>
</xsl:template>
<xsl:template match="item" mode="numpages">
<a href="{@link}">
<xsl:value-of select="." />
</a>
</xsl:template>
<xsl:template match="item[@is-active = '1']" mode="numpages">
<a href="{@link}" class="active"><xsl:value-of select="." /></a>
</xsl:template>
<xsl:template match="toprev_link">
<a class="prev" href="{.}">
<xsl:text>&previous-page;</xsl:text>
</a>
</xsl:template>
<xsl:template match="tonext_link">
<span>
<xsl:text>|</xsl:text>
</span>
<a class="next" href="{.}">
<xsl:text>&next-page;</xsl:text>
</a>
</xsl:template>
<xsl:template match="udata[not(tobegin_link) and toend_link]" mode="paging">
<a class="active" href="{toend_link}">В конец »</a>
</xsl:template>
<xsl:template match="item" mode="slider">
<xsl:apply-templates select="preceding-sibling::item[1]" mode="slider_back" />
<xsl:apply-templates select="following-sibling::item[1]" mode="slider_next" />
</xsl:template>
<xsl:template match="item" mode="slider_back">
<a href="{@link}" title="&previous-page;" class="back" />
</xsl:template>
<xsl:template match="item" mode="slider_next">
<a href="{@link}" title="&next-page;" class="next" />
</xsl:template>
</xsl:stylesheet>
у вас уже все есть (хотя некоторые шаблоны немного смущает своей непонятнойстью или возможно избыточностью). Вам надо в шаблон
<xsl:template match="udata[@method = 'numpages'][count(items)]">
<div class="paging">
<xsl:apply-templates select="items/item" mode="numpages" />
<xsl:templates select="items/item" mode="paging" />
</div>
</xsl:template>
вставить вызовы <xsl:apply-templates select="tobegin_link" />
и <xsl:apply-templates select="toend_link" />
и добавить шаблоны для этих вызовов
<xsl:template match="tobegin_link">
<a class="begin" href="{.}">
<xsl:text>В начало</xsl:text>
</a>
</xsl:template>
<xsl:template match="toend_link">
<a class="end" href="{.}">
<xsl:text>В конец</xsl:text>
</a>
</xsl:template>