Название группы при выводе элемента

#
Название группы при выводе элемента
Здравствуйте.

Столкнулся с затруднениями при попытке вывести на странице элемента название группы, к которой он относится.
Фотогалерея реализована следующим образом: галерея -> группа альбомов -> альбом -> элемент.

Поискав на форуме решение, нашел следующий вариант: http://www.hostcms.ru/forums/17/3446/
Но, к сожалению, в моем случае данный код выводит на странице элемента название не конкретного альбома, к которому относится элемент, а группы альбомов.
Правильную переменную подобрать не удалось, был бы очень благодарен за помощь.
#
Re: Название группы при выводе элемента
У меня по понедельникам плохо с телепатией - голова от нее болит жутко :-/
Скиньте сюда хотя бы XSL-шаблон и XML который генерируется для этой страницы, и какой текст должен выводиться, тогда может чего подскажу
Заказов не беру. Консультирую редко.
#
Re: Название группы при выводе элемента
Kotoff писал(а):
У меня по понедельникам плохо с телепатией — голова от нее болит жутко: -/

Простите, если у меня не получилось понятно объяснить, чего хочу...
Мне нужно на странице с фотографией вывести название альбома, к которому она относится.

XSL-шаблон привожу ниже, жирным выделил часть кода, с помощью которого пытаюсь вывести название альбома. XML выложу чуть позже.

<?xml version="1.0" encoding="windows-1251"?>
<!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="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
   
   <!-- ОтображениеПодробнойИнформацииОФотографии -->
   
   <xsl:template match="/">
      <xsl:apply-templates select="/document/item"/>
   </xsl:template>
   
   
   <xsl:template match="/document/item">
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="/document/information_system/parent_group_id"/>
      
      
      <table style="width: 610px;" border="0">
         
         <tbody>
            <tr>
               <td class="award" style="width: 610px; height: 72px; padding-top: 37px; padding-left: 130px;" background="/img/photo.gif"><xsl:value-of disable-output-escaping="yes"  select="/document/group/name"/>
               </td>
            </tr>
         </tbody>
      </table>
      

      
      <!-- Выводим сообщение -->
      <xsl:if test="/document/message/node()">
         <div id="message">
            <xsl:value-of disable-output-escaping="yes" select="/document/message"/>
         </div>
      </xsl:if>
      
      <center>
         <xsl:if test="/document/PrevName/node()">
            
            <a class="next" href="{/document/information_system/url}{/document/PrevLink}">предыдущая</a>
         </xsl:if>
         |<xsl:variable name="item_group_id" select="@group_id"/>
         <xsl:choose>
            <xsl:when test="$item_group_id != 0">
               <a class="next" href="{/document/information_system/url}{//group[@id = $item_group_id]/fullpath}">вернуться к альбому</a>
            </xsl:when>
            <xsl:otherwise>
               <a class="next" href="{/document/information_system/url}">вернуться к альбому</a>
            </xsl:otherwise>
         </xsl:choose>|
         <xsl:if test="/document/NextName/node()">
            
            <a class="next" href="{/document/information_system/url}{/document/NextLink}">следующая</a>
         </xsl:if>
      </center>
      
      <!-- Проверяем задан ли путь к файлу большого изображения -->
      <xsl:if test="item_image!=''">
         <p align="center">
            <img src="{item_image}" style="margin-right: 10px; margin-bottom: 0px; border: 1px solid #c6bea7; padding: 0px;"/>
         </p>
      </xsl:if>
      
      <!-- Текст информационного элемента -->
      <p>
         <xsl:value-of disable-output-escaping="yes" select="item_text"/>
      </p>
      

      
      
      
      
      
      <center>
         <xsl:if test="/document/PrevName/node()">
            
            <a class="next" href="{/document/information_system/url}{/document/PrevLink}">предыдущая</a>
         </xsl:if>
         |<xsl:variable name="item_group_id" select="@group_id"/>
         <xsl:choose>
            <xsl:when test="$item_group_id != 0">
               <a class="next" href="{/document/information_system/url}{//group[@id = $item_group_id]/fullpath}">вернуться к альбому</a>
            </xsl:when>
            <xsl:otherwise>
               <a class="next" href="{/document/information_system/url}">вернуться к альбому</a>
            </xsl:otherwise>
         </xsl:choose>|
         <xsl:if test="/document/NextName/node()">
            
            <a class="next" href="{/document/information_system/url}{/document/NextLink}">следующая</a>
         </xsl:if>
      </center>
   </xsl:template>
   
   
   
   
   
   
   
   
   
   

   
   
   
   
   
   <!-- Цикл для вывода строк ссылок -->
   <xsl:template name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="prefix">page</xsl:param>
      <xsl:param name="link"/>
      <xsl:param name="items_on_page"/>
      <xsl:param name="current_page"/>
      <xsl:param name="count_items"/>
      <xsl:param name="visible_pages"/>
      
      <xsl:variable name="n" select="$count_items div $items_on_page"/>
      
      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/document/blocks/parent_group_id"/>
      
      
      <!-- Считаем количество выводимых ссылок перед текущим элементом -->
      <xsl:variable name="pre_count_page">
         <xsl:choose>
            <xsl:when test="$current_page &gt; ($n - (round($visible_pages div 2) - 1))">
               <xsl:value-of select="$visible_pages - ($n - $current_page)"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="round($visible_pages div 2) - 1"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Считаем количество выводимых ссылок после текущего элемента -->
      <xsl:variable name="post_count_page">
         <xsl:choose>
            <xsl:when test="0 &gt; $current_page - (round($visible_pages div 2) - 1)">
               <xsl:value-of select="$visible_pages - $current_page - 1"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
                     <xsl:value-of select="$visible_pages div 2"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="round($visible_pages div 2) - 1"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <xsl:if test="$count_items &gt; $items_on_page and $n &gt; $i">
         <!-- Ставим ссылку на страницу-->
         <xsl:if test="$i != $current_page">
            <!-- Определяем адрес тэга -->
            <xsl:variable name="tag_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="count(/document/blocks/selected_tags/tag) != 0">tag/<xsl:value-of select="/document/blocks/selected_tags/tag/tag_path_name"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            
            <!-- Определяем адрес ссылки -->
            <xsl:variable name="number_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="$i != 0">
                     <xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            
            <!-- Выводим ссылку на первую страницу -->
            <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = 0">
               <a href="{$link}" class="page_link" style="text-decoration: none;">&#x2190;</a>
            </xsl:if>
            
            <xsl:choose>
               <xsl:when test="$i &gt;= ($current_page - $pre_count_page) and ($current_page + $post_count_page) &gt;= $i">
                  
                  <!-- Выводим ссылки на видимые страницы -->
                  Страница: <a href="{$link}{$tag_link}{$number_link}" class="page_link">
                     <xsl:value-of select="$i + 1"/>
                  </a>
               </xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
            
            <!-- Выводим ссылку на последнюю страницу -->
            <xsl:if test="$i+1 &gt;= $n and $n &gt; ($current_page + 1 + $post_count_page)">
               <xsl:choose>
                  <xsl:when test="$n &gt; round($n)">
                     <!-- Выводим ссылку на последнюю страницу -->
                     <a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:when>
                  <xsl:otherwise>
                     <a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:if>
         </xsl:if>
         
         <!-- Не ставим ссылку на страницу-->
         <xsl:if test="$i = $current_page">
            <span class="current">
               <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="prefix" select="$prefix"/>
            <xsl:with-param name="link" select="$link"/>
            <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="visible_pages" select="$visible_pages"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <!-- Склонение после числительных -->
   <xsl:template name="declension">
      
      <xsl:param name="number" select="number"/>
      
      <!-- Именительный падеж -->
      <xsl:variable name="nominative">
         <xsl:text>просмотр</xsl:text>
      </xsl:variable>
      
      <!-- Родительный падеж, единственное число -->
      <xsl:variable name="genitive_singular">
         <xsl:text>просмотра</xsl:text>
      </xsl:variable>
      
      
      <xsl:variable name="genitive_plural">
         <xsl:text>просмотров</xsl:text>
      </xsl:variable>
      
      <xsl:variable name="last_digit">
         <xsl:value-of select="$number mod 10"/>
      </xsl:variable>
      
      <xsl:variable name="last_two_digits">
         <xsl:value-of select="$number mod 100"/>
      </xsl:variable>
      
      <xsl:choose>
         <xsl:when test="$last_digit = 1 and $last_two_digits != 11">
            <xsl:value-of select="$nominative"/>
         </xsl:when>
         <xsl:when test="$last_digit = 2 and $last_two_digits != 12
            or $last_digit = 3 and $last_two_digits != 13
            or $last_digit = 4 and $last_two_digits != 14">
            <xsl:value-of select="$genitive_singular"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="$genitive_plural"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
</xsl:stylesheet>
#
Re: Название группы при выводе элемента
Вот XML страницы, нужно, чтобы выводилось "Washington", а выводится "Города".


<?xml version="1.0" encoding="windows-1251"?>
<document>
   <site_user_id>0</site_user_id>
   <ОтображатьСсылкуНаАрхив>0</ОтображатьСсылкуНаАрхив>
   <ОтображатьСсылкиНаСледующиеСтраницы>1</ОтображатьСсылкиНаСледующиеСтраницы>
   <show_comments>0</show_comments>
   <PrevName>3</PrevName>
   <PrevLink>goroda/washington/3/</PrevLink>
   <NextName>5</NextName>
   <NextLink> goroda/washington /5/</NextLink>
   <information_system id="4">
      <name>Фотогалерея</name>
      <url>/photo/</url>
      <description></description>
      <captcha_used>1</captcha_used>
      <captcha_key>876</captcha_key>
      <parent_group_id>36</parent_group_id>
   </information_system>
   <group id="9" parent_id="0">
      <site_user>0</site_user>
      <name>Города</name>
      <description></description>
      <order>4</order>
      <path>goroda</path>
      <fullpath>goroda/</fullpath>
      <access>-1</access>
      <activity>1</activity>
      <count_items>0</count_items>
      <count_all_items>53</count_all_items>
      <count_groups>6</count_groups>
      <count_all_groups>6</count_all_groups>
      <small_image width="105" height="140">/upload/information_system_4/0/0/9/group_9/small_information_groups_9.jpg</small_image>
      <allow_indexation>1</allow_indexation>
      <seo_title>Города</seo_title>
      <seo_description> в</seo_description>
      <seo_keywords> </seo_keywords>
      <propertys>
      </propertys>
      <group id="13" parent_id="9">
         <site_user>0</site_user>
         <name>Vena</name>
         <description></description>
         <order>0</order>
         <path>13</path>
         <fullpath>goroda/13/</fullpath>
         <access>-1</access>
         <activity>1</activity>
         <count_items>6</count_items>
         <count_all_items>6</count_all_items>
         <count_groups>0</count_groups>
         <count_all_groups>0</count_all_groups>
         <small_image width="105" height="140">/upload/information_system_4/0/1/3/group_13/small_information_groups_13.jpg</small_image>
         <allow_indexation>1</allow_indexation>
         <seo_title>Вена</seo_title>
         <seo_description> </seo_description>
         <seo_keywords> </seo_keywords>
         <propertys>
         </propertys>
      </group>
      <group id="20" parent_id="9">
         <site_user>0</site_user>
         <name>Amsterdam</name>
         <description></description>
         <order>0</order>
         <path>amsterdam</path>
         <fullpath>goroda/amsterdam/</fullpath>
         <access>-1</access>
         <activity>1</activity>
         <count_items>8</count_items>
         <count_all_items>8</count_all_items>
         <count_groups>0</count_groups>
         <count_all_groups>0</count_all_groups>
         <small_image width="105" height="140">/upload/information_system_4/0/2/0/group_20/small_information_groups_20.jpg</small_image>
         <allow_indexation>1</allow_indexation>
         <seo_title>Амстердам</seo_title>
         <seo_description> </seo_description>
         <seo_keywords> </seo_keywords>
         <propertys>
         </propertys>
      </group>
      <group id="26" parent_id="9">
         <site_user>0</site_user>
         <name>Paris</name>
         <description></description>
         <order>0</order>
         <path>paris</path>
         <fullpath>goroda/paris/</fullpath>
         <access>-1</access>
         <activity>1</activity>
         <count_items>11</count_items>
         <count_all_items>11</count_all_items>
         <count_groups>0</count_groups>
         <count_all_groups>0</count_all_groups>
         <big_image  width="376" height="468">/upload/information_system_4/0/2/6/group_26/information_groups_26.jpg</big_image>
         <small_image width="112" height="140">/upload/information_system_4/0/2/6/group_26/small_information_groups_26.jpg</small_image>
         <allow_indexation>1</allow_indexation>
         <seo_title>Париж</seo_title>
         <seo_description> </seo_description>
         <seo_keywords> </seo_keywords>
         <propertys>
         </propertys>
      </group>
   
      <group id="36" parent_id="9">
         <site_user>0</site_user>
         <name>Washington </name>
         <description></description>
         <order>0</order>
         <path>washington</path>
         <fullpath>goroda/washington/</fullpath>
         <access>-1</access>
         <activity>1</activity>
         <count_items>13</count_items>
         <count_all_items>13</count_all_items>
         <count_groups>0</count_groups>
         <count_all_groups>0</count_all_groups>
         <big_image  width="400" height="600">/upload/information_system_4/0/3/6/group_36/information_groups_36.jpg</big_image>
         <small_image width="93" height="140">/upload/information_system_4/0/3/6/group_36/small_information_groups_36.jpg</small_image>
         <allow_indexation>1</allow_indexation>
         <seo_title> Washington, 2008</seo_title>
         <seo_description> Washington, 2008</seo_description>
         <seo_keywords> Washington, 2008</seo_keywords>
         <propertys>
         </propertys>
      </group>
   </group>
   <item id="229" group_id="36">
      <item_date>17.11.2009</item_date>
      <item_datetime>17.11.2009 15:19:16</item_datetime>
      <item_time>15:19:16</item_time>
      <item_putoff_date>17.11.2009 15:19:16</item_putoff_date>
      <item_putend_date>00.00.0000 00:00:00</item_putend_date>
      <item_name>4</item_name>
      <item_description></item_description>
      <part count="1">0</part>
      <item_text></item_text>
      <item_image width="400" height="596">/upload/information_system_4/2/2/9/item_229/information_items_229.jpg</item_image>
      <item_small_image width="100" height="150">/upload/information_system_4/2/2/9/item_229/small_information_items_229.jpg</item_small_image>
      <item_status>1</item_status>
      <item_seo_title> Washington, 2008</item_seo_title>
      <item_seo_description> Washington, 2008</item_seo_description>
      <item_seo_keywords> Washington, 2008</item_seo_keywords>
      <item_access>-1</item_access>
      <item_path>/photo/goroda/washington/4/</item_path>
      <item_path_field>4</item_path_field>
      <item_show_count>21</item_show_count>
      <site_user_id>0</site_user_id>
      <item_propertys>
      </item_propertys>
      <item_comments>
         <count_comments>0</count_comments>
         <grade_sum>0</grade_sum>
         <grade_count>0</grade_count>
         <average_grade>0</average_grade>
      </item_comments>
   </item>
</document>

#
Re: Название группы при выводе элемента
вот так:

<?xml version="1.0" encoding="windows-1251"?>
<!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="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>

   <!-- ОтображениеПодробнойИнформацииОФотографии -->

   <xsl:template match="/">
      <xsl:apply-templates select="/document/item"/>
   </xsl:template>


   <xsl:template match="/document/item">



      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="/document/information_system/parent_group_id"/>


      <table style="width: 610px;" border="0">

         <tbody>
            <tr>
               <td class="award" style="width: 610px; height: 72px; padding-top: 37px; padding-left: 130px;" background="/img/photo.gif">
                  <xsl:variable name="item_group_id" select="@group_id"/>
                  <xsl:value-of disable-output-escaping="yes" select="//group[@id = $item_group_id]/name"/>

               </td>
            </tr>
         </tbody>
      </table>

      <!-- Выводим сообщение -->
      <xsl:if test="/document/message/node()">
         <div id="message">
            <xsl:value-of disable-output-escaping="yes" select="/document/message"/>
         </div>
      </xsl:if>

      <center>
         <xsl:if test="/document/PrevName/node()">

            <a class="next" href="{/document/information_system/url}{/document/PrevLink}">предыдущая</a>
         </xsl:if>|<xsl:variable name="item_group_id" select="@group_id"/>
         <xsl:choose>
            <xsl:when test="$item_group_id != 0">
               <a class="next" href="{/document/information_system/url}{//group[@id = $item_group_id]/fullpath}">вернуться к альбому</a>
            </xsl:when>
            <xsl:otherwise>
               <a class="next" href="{/document/information_system/url}">вернуться к альбому</a>
            </xsl:otherwise>
         </xsl:choose>|
         <xsl:if test="/document/NextName/node()">

            <a class="next" href="{/document/information_system/url}{/document/NextLink}">следующая</a>
         </xsl:if>
      </center>

      <!-- Проверяем задан ли путь к файлу большого изображения -->
      <xsl:if test="item_image!=''">
         <p align="center">
            <img src="{item_image}" style="margin-right: 10px; margin-bottom: 0px; border: 1px solid #c6bea7; padding: 0px;"/>
         </p>
      </xsl:if>

      <!-- Текст информационного элемента -->
      <p>
         <xsl:value-of disable-output-escaping="yes" select="item_text"/>
      </p>

      <center>
         <xsl:if test="/document/PrevName/node()">

            <a class="next" href="{/document/information_system/url}{/document/PrevLink}">предыдущая</a>
         </xsl:if>|<xsl:variable name="item_group_id" select="@group_id"/>
         <xsl:choose>
            <xsl:when test="$item_group_id != 0">
               <a class="next" href="{/document/information_system/url}{//group[@id = $item_group_id]/fullpath}">вернуться к альбому</a>
            </xsl:when>
            <xsl:otherwise>
               <a class="next" href="{/document/information_system/url}">вернуться к альбому</a>
            </xsl:otherwise>
         </xsl:choose>|
         <xsl:if test="/document/NextName/node()">

            <a class="next" href="{/document/information_system/url}{/document/NextLink}">следующая</a>
         </xsl:if>
      </center>
   </xsl:template>


   <!-- Цикл для вывода строк ссылок -->
   <xsl:template name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="prefix">page</xsl:param>
      <xsl:param name="link"/>
      <xsl:param name="items_on_page"/>
      <xsl:param name="current_page"/>
      <xsl:param name="count_items"/>
      <xsl:param name="visible_pages"/>

      <xsl:variable name="n" select="$count_items div $items_on_page"/>

      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/document/blocks/parent_group_id"/>


      <!-- Считаем количество выводимых ссылок перед текущим элементом -->
      <xsl:variable name="pre_count_page">
         <xsl:choose>
            <xsl:when test="$current_page &gt; ($n - (round($visible_pages div 2) - 1))">
               <xsl:value-of select="$visible_pages - ($n - $current_page)"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="round($visible_pages div 2) - 1"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>

      <!-- Считаем количество выводимых ссылок после текущего элемента -->
      <xsl:variable name="post_count_page">
         <xsl:choose>
            <xsl:when test="0 &gt; $current_page - (round($visible_pages div 2) - 1)">
               <xsl:value-of select="$visible_pages - $current_page - 1"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
                     <xsl:value-of select="$visible_pages div 2"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="round($visible_pages div 2) - 1"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>

      <xsl:if test="$count_items &gt; $items_on_page and $n &gt; $i">
         <!-- Ставим ссылку на страницу-->
         <xsl:if test="$i != $current_page">
            <!-- Определяем адрес тэга -->
            <xsl:variable name="tag_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="count(/document/blocks/selected_tags/tag) != 0">tag/<xsl:value-of select="/document/blocks/selected_tags/tag/tag_path_name"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>

            <!-- Определяем адрес ссылки -->
            <xsl:variable name="number_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="$i != 0">
                     <xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>

            <!-- Выводим ссылку на первую страницу -->
            <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = 0">
               <a href="{$link}" class="page_link" style="text-decoration: none;">&#x2190;</a>
            </xsl:if>

            <xsl:choose>
               <xsl:when test="$i &gt;= ($current_page - $pre_count_page) and ($current_page + $post_count_page) &gt;= $i">

                  <!-- Выводим ссылки на видимые страницы -->Страница: <a href="{$link}{$tag_link}{$number_link}" class="page_link">
                     <xsl:value-of select="$i + 1"/></a></xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>

            <!-- Выводим ссылку на последнюю страницу -->
            <xsl:if test="$i+1 &gt;= $n and $n &gt; ($current_page + 1 + $post_count_page)">
               <xsl:choose>
                  <xsl:when test="$n &gt; round($n)">
                     <!-- Выводим ссылку на последнюю страницу -->
                     <a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:when>
                  <xsl:otherwise>
                     <a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:if>
         </xsl:if>

         <!-- Не ставим ссылку на страницу-->
         <xsl:if test="$i = $current_page">
            <span class="current">
               <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="prefix" select="$prefix"/>
            <xsl:with-param name="link" select="$link"/>
            <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="visible_pages" select="$visible_pages"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>

   <!-- Склонение после числительных -->
   <xsl:template name="declension">

      <xsl:param name="number" select="number"/>

      <!-- Именительный падеж -->
      <xsl:variable name="nominative">
         <xsl:text>просмотр</xsl:text>
      </xsl:variable>

      <!-- Родительный падеж, единственное число -->
      <xsl:variable name="genitive_singular">
         <xsl:text>просмотра</xsl:text>
      </xsl:variable>


      <xsl:variable name="genitive_plural">
         <xsl:text>просмотров</xsl:text>
      </xsl:variable>

      <xsl:variable name="last_digit">
         <xsl:value-of select="$number mod 10"/>
      </xsl:variable>

      <xsl:variable name="last_two_digits">
         <xsl:value-of select="$number mod 100"/>
      </xsl:variable>

      <xsl:choose>
         <xsl:when test="$last_digit = 1 and $last_two_digits != 11">
            <xsl:value-of select="$nominative"/>
         </xsl:when>
         <xsl:when test="$last_digit = 2 and $last_two_digits != 12             or $last_digit = 3 and $last_two_digits != 13             or $last_digit = 4 and $last_two_digits != 14">
            <xsl:value-of select="$genitive_singular"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="$genitive_plural"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
</xsl:stylesheet>
Заказов не беру. Консультирую редко.
#
Re: Название группы при выводе элемента
Kotoff писал(а):
вот так:

Спасибо огромное, все работает
#
Re: Название группы при выводе элемента
Да пожалуйста!
Заказов не беру. Консультирую редко.
Авторизация