Переопределить количество выводимых товаров внутри XSL-шаблона

#
Переопределить количество выводимых товаров внутри 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">
   <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:decimal-format name="my" decimal-separator="," grouping-separator=" "/>
   
   <xsl:template match="/">
      <xsl:apply-templates select="/shop"/>
   </xsl:template>
   
   <!-- Шаблон для магазина -->
   <xsl:template match="/shop">
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="@current_group_id"/>
      
      <!-- Если в находимся корне - выводим название и описание информационной системы -->
      <xsl:if test="$parent_group_id = 0 and count(selected_tags/tag) != 0">
         <h1>
            <xsl:value-of disable-output-escaping="yes" select="/shop/selected_tags/tag/tag_name"/>
         </h1>
         <xsl:value-of disable-output-escaping="yes" select="/shop/selected_tags/tag/tag_description"/>
      </xsl:if>
      <xsl:if test="$parent_group_id = 0 and count(selected_tags/tag) = 0">
         <h1>
            <xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
         </h1>
         <xsl:value-of disable-output-escaping="yes" select="/shop/description"/>
      </xsl:if>
      
      
      <!-- Если в находимся в группе - выводим название группы -->
      <xsl:if test="$parent_group_id != 0 and .//group[@id=$parent_group_id]/description != ''">
         <xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/description"/>
      </xsl:if>
      <xsl:if test="$parent_group_id != 0 and .//group[@id=$parent_group_id]/description = ''">
         <h1><xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/name"/></h1>
      </xsl:if>
      
      <!-- Обработка выбранных тэгов -->
      <!-- xsl:if test="count(selected_tags/tag) = 1">
   <h2>Метка &#8212; <strong><xsl:value-of select="selected_tags/tag/tag_name"/></strong>.</h2>
   </xsl:if-->
   
   <xsl:variable name="count">1</xsl:variable>
   
   <!-- Отображение подгрупп данной группы, только если подгруппы есть -->
   <xsl:if test="count(//group[@parent=$parent_group_id]) &gt; 0">
      <table width="100%" border="0" cellpadding="3" cellspacing="0">
         <xsl:apply-templates select=".//group[@parent=$parent_group_id and count_all_items != 0]"/>
      </table>
   </xsl:if>
   
   <!-- дополнение пути для action, если выбрана метка -->
<xsl:variable name="form_tag_path"><xsl:if test="count(selected_tags/tag) = 1">tag/<xsl:value-of select="selected_tags/tag/tag_path_name"/>/</xsl:if></xsl:variable>
   <xsl:if test="count(item) &gt; 0  or apply_filter = 1">
      <form method="get" action="{/shop/path}{//group[@id=$parent_group_id]/fullpath}{$form_tag_path}">
         <xsl:if test="property_xml/node() and property_xml='&amp;all_group=1'">
            <input type="hidden" name="all_group" value="1"/>
         </xsl:if>
         <div class="shop_block">
            <div>
               Цена от:&#xA0;
               <input name="price_from" size="5" type="text">
                  <xsl:if test="/shop/price_from != 0">
                     <xsl:attribute name="value">
                        <xsl:value-of disable-output-escaping="yes" select="/shop/price_from"/>
                     </xsl:attribute>
                  </xsl:if>
               </input>&#xA0;
               
               до:&#xA0;
               <input name="price_to" size="5" type="text">
                  <xsl:if test="/shop/price_to != 0">
                     <xsl:attribute name="value">
                        <xsl:value-of disable-output-escaping="yes" select="/shop/price_to"/>
                     </xsl:attribute>
                  </xsl:if>
               </input>&#xA0;
               
               <span style="white-space: nowrap">Товаров на странице:</span>&#xA0;
               <select name="on_page">
                  <option value="0">&#x2026;</option>
                  <xsl:call-template name="for_on_page">
                     <xsl:with-param name="i" select="10"/>
                     <xsl:with-param name="n" select="50"/>
                  </xsl:call-template>
               </select>&#xA0;
               
               <input name="apply_filter" value="Применить" type="submit"/>
            </div>
         </div>
         
         <!-- Сортировка товаров -->
         <div class="shop_block">
            <!-- Определяем ссылку с параметрами фильтра -->
            <xsl:variable name="filter">
               <xsl:if test="/shop/apply_filter/node()">?action=apply_filter&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
                  <xsl:if test="/shop/property_xml/node()">
                     <!-- GET для доп. свойств -->
                     <xsl:value-of select="/shop/property_xml"/>
                  </xsl:if>
               </xsl:if>
            </xsl:variable>
            
            <!-- Определяем первый символ вопрос или амперсанд -->
            <xsl:variable name="first_symbol">
               <xsl:choose>
                  <xsl:when test="$filter != ''">&amp;</xsl:when>
                  <xsl:otherwise>?</xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            <div style="float:left;">
               Сортировать по алфавиту
            </div>
            <xsl:choose>
               <xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'ASC'">
                  <div class="arrow_up">
                     <img src="/hostcmsfiles/images/arrow_up.png" style="float: left; filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
                  </div>
               </xsl:when>
               <xsl:otherwise>
                  <div class="arrow_up_gray">
                     <a href="{$filter}{$first_symbol}sort_by_field=1&amp;order_direction=1" class="without_decor">
                        <img src="/hostcmsfiles/images/arrow_up_gray.png" alt="по возрастанию"/>
                     </a>
                  </div>
               </xsl:otherwise>
            </xsl:choose>
            
            <xsl:choose>
               <xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'DESC'">
                  <div class="arrow_down">
                     <img src="/hostcmsfiles/images/arrow_down.png" alt="по убыванию"/>
                  </div>
               </xsl:when>
               <xsl:otherwise>
                  <div class="arrow_down_gray">
                     <a href="{$filter}{$first_symbol}sort_by_field=1&amp;order_direction=2" class="without_decor">
                        <img src="/hostcmsfiles/images/arrow_down_gray.png" alt="по убыванию"/>
                     </a>
                  </div>
               </xsl:otherwise>
         </xsl:choose><div style="float:left;">,&#xA0;по цене</div>
            
            <xsl:choose>
               <xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'ASC'">
                  <div class="arrow_up">
                     <img src="/hostcmsfiles/images/arrow_up.png" alt="по возрастанию"/>
                  </div>
               </xsl:when>
               <xsl:otherwise>
                  <div class="arrow_up_gray">
                     <a href="{$filter}{$first_symbol}sort_by_field=2&amp;order_direction=1" class="without_decor">
                        <img src="/hostcmsfiles/images/arrow_up_gray.png" alt="по возрастанию"/></a>
                  </div>
               </xsl:otherwise>
            </xsl:choose>
            
            <xsl:choose>
               <xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'DESC'">
                  <div class="arrow_down">
                     <img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
                  </div>
               </xsl:when>
               <xsl:otherwise>
                  <div class="arrow_down_gray">
                     <a href="{$filter}{$first_symbol}sort_by_field=2&amp;order_direction=2" class="without_decor">
                        <img src="/hostcmsfiles/images/arrow_down_gray.png" alt="по убыванию"/>
                     </a>
                  </div>
               </xsl:otherwise>
            </xsl:choose>
            <div class="clear"></div>
         </div>
         
         <!-- Определяем ссылку с параметрами фильтра -->
         <xsl:variable name="filter">
            <xsl:choose>
               <xsl:when test="/shop/apply_filter/node()">?action=apply_filter&amp;producer_id=<xsl:value-of select="/shop/producer_id"/>&amp;saller_id=<xsl:value-of select="/shop/saller_id"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
                  <xsl:if test="/shop/property_xml/node()">
                     <!-- GET для доп. свойств -->
                     <xsl:value-of select="/shop/property_xml"/>
                  </xsl:if>
               </xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         <!-- Определяем первый символ вопрос или амперсанд -->
         <xsl:variable name="first_symbol">
            <xsl:choose>
               <xsl:when test="$filter != ''">&amp;</xsl:when>
               <xsl:otherwise>?</xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <!-- Вывод товаров -->
         <div class="content_items_line_in_catalog">
            <xsl:choose>
               <xsl:when test="/shop/selected_tags/tag/tag_path_name = 'optika'">
                  <xsl:apply-templates select="item" mode="first"/>
               </xsl:when>
               <xsl:otherwise>
                  <table cellpadding="3" cellspacing="0" style="font-size:11px;">
                     <tr>
                        <th>Фото</th>
                        <th>Артикул</th>
                        <th>Наименование</th>
                        <th>Год</th>
                        <th>Оригинальный №</th>
                        <th>Цена</th>
                        <th></th>
                        <th>Наличие</th>
                     </tr>
                     <xsl:apply-templates select="item" mode="second"/>
                  </table>
               </xsl:otherwise>
            </xsl:choose>
            <div class="clear"></div>
         </div>
         
         <xsl:if test="count_items &gt; 0 and items_on_page &gt; 0 and count_items &gt; items_on_page">
            
            <xsl:variable name="count_pages" select="ceiling(count_items div items_on_page)"/>
            
            <xsl:variable name="visible_pages" select="5"/>
            
            <xsl:variable name="real_visible_pages"><xsl:choose>
                  <xsl:when test="$count_pages &lt; $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
                  <xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
            </xsl:choose></xsl:variable>
            
            <!-- Считаем количество выводимых ссылок перед текущим элементом -->
            <xsl:variable name="pre_count_page"><xsl:choose>
                  <xsl:when test="current_page  - (floor($real_visible_pages div 2)) &lt; 0">
                     <xsl:value-of select="current_page"/>
                  </xsl:when>
                  <xsl:when test="($count_pages  - current_page - 1) &lt; floor($real_visible_pages div 2)">
                     <xsl:value-of select="$real_visible_pages - ($count_pages  - current_page - 1) - 1"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:choose>
                        <xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
                           <xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:value-of select="floor($real_visible_pages div 2)"/>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:otherwise>
            </xsl:choose></xsl:variable>
            
            <!-- Считаем количество выводимых ссылок после текущего элемента -->
            <xsl:variable name="post_count_page"><xsl:choose>
                  <xsl:when test="0 &gt; current_page - (floor($real_visible_pages div 2) - 1)">
                     <xsl:value-of select="$real_visible_pages - current_page - 1"/>
                  </xsl:when>
                  <xsl:when test="($count_pages  - current_page - 1) &lt; floor($real_visible_pages div 2)">
                     <xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
                  </xsl:otherwise>
            </xsl:choose></xsl:variable>
            
            <xsl:variable name="i"><xsl:choose>
                  <xsl:when test="current_page + 1 = $count_pages"><xsl:value-of select="current_page - $real_visible_pages + 1"/></xsl:when>
                  <xsl:when test="current_page - $pre_count_page &gt; 0"><xsl:value-of select="current_page - $pre_count_page"/></xsl:when>
                  <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose></xsl:variable>
            
            <div class="pages">
               <xsl:call-template name="for">
                  <xsl:with-param name="items_on_page" select="items_on_page"/>
                  <xsl:with-param name="current_page" select="current_page"/>
                  <xsl:with-param name="count_items" select="count_items"/>
                  <xsl:with-param name="i" select="$i"/>
                  <xsl:with-param name="post_count_page" select="$post_count_page"/>
                  <xsl:with-param name="pre_count_page" select="$pre_count_page"/>
                  <xsl:with-param name="visible_pages" select="$real_visible_pages"/>
               </xsl:call-template>
            </div>
            <div class="clear"></div>
         </xsl:if>
         
      </form>
   </xsl:if>
</xsl:template>

<!-- Цикл с шагом 10 для select'a количества элементов на страницу -->
<xsl:template name="for_on_page">
   <xsl:param name="i" select="0"/>
   <xsl:param name="n"/>
   
   <option value="{$i}">
      <xsl:if test="$i = /shop/on_page">
         <xsl:attribute name="selected">
         </xsl:attribute>
      </xsl:if>
      <xsl:value-of select="$i"/>
   </option>
   
   <xsl:if test="$n &gt; $i">
      <!-- Рекурсивный вызов шаблона -->
      <xsl:call-template name="for_on_page">
         <xsl:with-param name="i" select="$i + 10"/>
         <xsl:with-param name="n" select="$n"/>
      </xsl:call-template>
   </xsl:if>
</xsl:template>

<!-- Шаблон для групп товара -->
<xsl:template match="group">
   <xsl:variable name="parent_id" select="@parent"/>
   
   <!-- Если был передан тег, допишем в ссылки с группы -->
   <xsl:variable name="tagpath">
      <xsl:choose>
         <xsl:when test="count(/shop/selected_tags/tag) > 0">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name" />/</xsl:when>
         <xsl:otherwise></xsl:otherwise>
      </xsl:choose>
   </xsl:variable>
   
   <td width="33%" valign="top">
      <div style="margin-bottom:10px;">
         <a href="{/shop/path}{fullpath}{$tagpath}" style="font-weight: bold">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
      </a>&#xA0;<span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/>)</span>
         
         <xsl:if test="count(group) &gt; 1">
            <xsl:apply-templates select="group" mode="sub_group"/>
         </xsl:if>
      </div>
   </td>
   
   <xsl:if test="position() mod 3 = 0">
      
      <xsl:text disable-output-escaping="yes">
         &lt;/tr&gt;
         &lt;tr&gt;
      </xsl:text>
   </xsl:if>
</xsl:template>

<!-- Шаблон для подразделов -->
<xsl:template match="group" mode="sub_group">
   <a href="{/shop/path}{fullpath}">
      <xsl:value-of disable-output-escaping="yes" select="name"/>
   </a>
   
   <xsl:variable name="parent_id" select="@parent"/>
   <!-- Ставим запятую после группы, за которой следуют еще группы из данной родителской группы -->
   <xsl:if test="position() != last() and count(//group[@parent = $parent_id]) &gt; 1">,&#xA0;</xsl:if>
</xsl:template>

<!-- Шаблон для товара -->
<xsl:template match="item" mode="first">
   
   <!-- Определяем цвет фона -->
   <xsl:variable name="background_color">
      <xsl:choose>
         <xsl:when test="(position() + 1) mod 2 &gt; 0">#f7f7f7</xsl:when>
         <xsl:otherwise>#ffffff</xsl:otherwise>
      </xsl:choose>
   </xsl:variable>
   
   <div class="content_item_in_catalog">
      <!-- Изображение для товара, если есть -->
      <xsl:choose>
         <xsl:when test="small_image!=''">
            <a href="{/shop/path}{fullpath}{path}/">
               <img src="/images/nophoto_small.jpg" width="169" height="88" alt="" />
            </a>
         </xsl:when>
         <xsl:otherwise>
            <a href="{/shop/path}{fullpath}{path}/">
               <img src="/images/catalog/{marking_of_goods}.jpg" width="169" height="88" alt="" />
            </a>
         </xsl:otherwise>
      </xsl:choose>
      
      <!-- Название товара -->
      <p><a href="{/shop/path}{fullpath}{path}/" class="item_title">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
         </a><br />
         
      <span class="code"><xsl:value-of select="property[@xml_name = 'depo_number']/value"/></span></p>
      
      <!-- Цена товара -->
      <p class="price">
         <xsl:choose>
            <xsl:when test="price_discount != 0">
               <xsl:variable name="price" select="price_discount"/>
               <xsl:value-of select="format-number($price, '### ##0', 'my')"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/>
            </xsl:when>
            <xsl:otherwise>
               цена&#xA0;договорная
            </xsl:otherwise>
         </xsl:choose>
         
         <!-- Ссылку на добавление в корзины выводим, если:
         type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
         type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
         что означает неограниченное количество -->
         <xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
            <input type="hidden" size="3" value="1" id="count_{@id}"/>
            <a href="{/shop/path}cart/?action=add&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value)">
               <img alt="В корзину" title="В корзину" src="/images/cart.png" style="margin:0 0 -4px 10px" />
            </a>
         </xsl:if>
      </p>
   </div>
   
   <!-- На строку - не более 3-х пунктов, если уже 3 выведено - начинаем новую строку -->
   <xsl:if test="position() mod 3 = 0 and position() != last()">
      <xsl:text disable-output-escaping="yes">
         &lt;div class="clear"&gt;&lt;/div&gt;
         &lt;/div&gt;
         &lt;div class="content_items_line_in_catalog"&gt;
      </xsl:text>
   </xsl:if>
</xsl:template>

<!-- Шаблон для товара (таблица) -->
<xsl:template match="item" mode="second">
   <tr>
      <td align="center" style="border-bottom:1px solid #cccccc;">
         <!-- Изображение для товара, если есть -->
         <xsl:choose>
            <xsl:when test="small_image!=''">
            </xsl:when>
            <xsl:otherwise>
               <a href="/images/catalog/{marking_of_goods}.jpg" class="lightbox">
                  <img src="/images/camera.png" width="16" height="16" alt="" style="vertical-align:middle;" />
               </a>
            </xsl:otherwise>
         </xsl:choose>
      </td>
      <td align="center" style="border-bottom:1px solid #cccccc;"><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></td>
      <td width="250" style="border-bottom:1px solid #cccccc;">
         <a href="{/shop/path}{fullpath}{path}/">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
         </a>
      </td>
      <td align="center" style="border-bottom:1px solid #cccccc;"><xsl:value-of select="property[@xml_name = 'model_year']/value"/></td>
      <td style="border-bottom:1px solid #cccccc;"><xsl:value-of select="property[@xml_name = 'original_number']/value"/></td>
      <!-- Цена товара -->
      <td align="right" style="border-bottom:1px solid #cccccc;">
         <xsl:choose>
            <xsl:when test="price_discount != 0">
               <xsl:variable name="price" select="price_discount"/>
               <xsl:value-of select="format-number($price, '### ##0', 'my')"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/>
            </xsl:when>
            <xsl:otherwise>
               цена&#xA0;договорная
            </xsl:otherwise>
         </xsl:choose>
      </td>
      <td style="border-bottom:1px solid #cccccc;">
         <!-- Ссылку на добавление в корзины выводим, если:
         type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
         type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
         что означает неограниченное количество -->
         <xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
            <input type="hidden" size="3" value="1" id="count_{@id}"/>
            <a href="{/shop/path}cart/?action=add&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value)">
               <img alt="В корзину" title="В корзину" src="/images/cart.png" width="16" style="margin:0 0 -4px 10px" />
            </a>
         </xsl:if>
      </td>
      <td align="center" style="border-bottom:1px solid #cccccc;"><xsl:value-of select="property[@xml_name = 'waiting']/value"/></td>
   </tr>
</xsl:template>

<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
   
   <xsl:param name="items_on_page"/>
   <xsl:param name="current_page"/>
   <xsl:param name="pre_count_page"/>
   <xsl:param name="post_count_page"/>
   <xsl:param name="i" select="0"/>
   <xsl:param name="count_items"/>
   <xsl:param name="visible_pages"/>
   
   <xsl:variable name="n" select="ceiling($count_items div $items_on_page)"/>
   
   <xsl:variable name="start_page"><xsl:choose>
         <xsl:when test="$current_page + 1 = $n"><xsl:value-of select="$current_page - $visible_pages + 1"/></xsl:when>
         <xsl:when test="$current_page - $pre_count_page &gt; 0"><xsl:value-of select="$current_page - $pre_count_page"/></xsl:when>
         <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose></xsl:variable>
   
   <xsl:if test="$i = $start_page and $current_page != 0">
      <span>
         &#8592; Ctrl
      </span>
   </xsl:if>
   
   <xsl:if test="$i = ($current_page + $post_count_page + 1) and $n != ($current_page+1)">
      <span>
         Ctrl &#8594;
      </span>
   </xsl:if>
   
   <xsl:if test="$count_items &gt; $items_on_page and ($current_page + $post_count_page + 1) &gt; $i">
      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
      
      <!-- Путь для тэга -->
      <xsl:variable name="tag_path">
         <xsl:if test="count(/shop/selected_tags/tag) = 1">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name"/>/</xsl:if>
      </xsl:variable>
      
      <!-- Определяем группу для формирования адреса ссылки -->
      <xsl:variable name="group_link">
         <xsl:choose>
            <!-- Если группа не корневая (!=0) -->
            <xsl:when test="$parent_group_id != 0">
               <xsl:value-of select="/shop//group[@id=$parent_group_id]/fullpath"/>
            </xsl:when>
            <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
            <xsl:otherwise></xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Определяем адрес ссылки -->
      <xsl:variable name="number_link">
         <xsl:choose>
            <!-- Если не нулевой уровень -->
            <xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
            <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
            <xsl:otherwise></xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Передаем фильтр -->
      <xsl:variable name="filter">
         <xsl:choose>
            <xsl:when test="/shop/apply_filter/node()">?action=apply_filter&amp;producer_id=<xsl:value-of select="/shop/producer_id"/>&amp;saller_id=<xsl:value-of select="/shop/saller_id"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
               <xsl:if test="/shop/property_xml/node()">
                  <!-- GET для доп. свойств -->
                  <xsl:value-of select="/shop/property_xml"/>
               </xsl:if>
            </xsl:when>
            <xsl:otherwise></xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Определяем первый символ вопрос или амперсанд -->
      <xsl:variable name="first_symbol">
         <xsl:choose>
            <xsl:when test="$filter != ''">&amp;</xsl:when>
            <xsl:otherwise>?</xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Данные для стрелок сортировки -->
      <xsl:variable name="arrows">
         <xsl:choose>
            <xsl:when test="(/shop/sort_by_field = 1) or (/shop/sort_by_field = 2)">
               <xsl:choose>
                  <!-- Стрелка вверх -->
                  <xsl:when test="/shop/order_direction = 'ASC'">
                     <xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&amp;order_direction=1</xsl:when>
                  <!-- Стрелка вниз -->
                  <xsl:otherwise>
                     <xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&amp;order_direction=2</xsl:otherwise>
               </xsl:choose>
            </xsl:when>
            <xsl:otherwise></xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Выводим ссылку на первую страницу -->
      <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = $start_page">
      <span><a href="{/shop/path}{$group_link}{$tag_path}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">&#x2190;</a></span>
      </xsl:if>
      
      <!-- Ставим ссылку на страницу-->
      <xsl:if test="$i != $current_page">
         <xsl:if test="($current_page - $pre_count_page) &lt;= $i and $i &lt; $n">
            <!-- Выводим ссылки на видимые страницы -->
            <span><a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link">
                  <xsl:value-of select="$i + 1"/>
            </a></span>
         </xsl:if>
         
         <!-- Выводим ссылку на последнюю страницу -->
         <xsl:if test="$i+1 &gt;= ($current_page + $post_count_page + 1) and $n &gt; ($current_page + 1 + $post_count_page)">
            <!-- Выводим ссылку на последнюю страницу -->
         <span><a href="{/shop/path}{$group_link}{$tag_path}page-{$n}/{$filter}{$arrows}" class="page_link" style="text-decoration: none;">&#x2192;</a></span>
         </xsl:if>
      </xsl:if>
      
      <!-- Ссылка на предыдущую страницу для Ctrl + влево -->
      <xsl:if test="$current_page != 0 and $i = $current_page">
         <xsl:variable name="prev_number_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <a href="{/shop/path}{$group_link}{$tag_path}{$prev_number_link}{$filter}{$arrows}" id="id_prev"></a>
      </xsl:if>
      
      <!-- Ссылка на следующую страницу для Ctrl + вправо -->
      <xsl:if test="($n - 1) > $current_page and $i = $current_page">
         <a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}" id="id_next"></a>
      </xsl:if>
      
      <!-- Не ставим ссылку на страницу-->
      <xsl:if test="$i = $current_page">
         <span class="cur_page">
            <xsl:value-of select="$i+1"/>
         </span>
      </xsl:if>
      
      <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
      <xsl:call-template name="for">
         <xsl:with-param name="i" select="$i + 1"/>
         <xsl:with-param name="items_on_page" select="$items_on_page"/>
         <xsl:with-param name="current_page" select="$current_page"/>
         <xsl:with-param name="count_items" select="$count_items"/>
         <xsl:with-param name="pre_count_page" select="$pre_count_page"/>
         <xsl:with-param name="post_count_page" select="$post_count_page"/>
         <xsl:with-param name="visible_pages" select="$visible_pages"/>
      </xsl:call-template>
   </xsl:if>
</xsl:template>
</xsl:stylesheet>
#
Re: Переопределить количество выводимых товаров внутри XSL-шаблона
onlinestudio,
переопределять количество выводимых товаров надо не в XSL в ТДС на php.
Заказов не беру. Консультирую редко.
#
Re: Переопределить количество выводимых товаров внутри XSL-шаблона
Kotoff, спасибо за наводку. Все получилось.
#
Re: Переопределить количество выводимых товаров внутри XSL-шаблона
onlinestudio, пожалуйста!
Заказов не беру. Консультирую редко.
Авторизация