Сделать массив в XSLT
В общем, из XML выбирается адрес элемента, например
/catalog/group/198/
Вопрос: как можно обрезать строку, чтобы получить путь к группе, а не к элементу?
То есть получить строку типа /catalog/group/
/catalog/group/198/
Вопрос: как можно обрезать строку, чтобы получить путь к группе, а не к элементу?
То есть получить строку типа /catalog/group/
Профессиональная разработка сайтов на HostCMS. Звоните: (843) 200-94-60, http://webinsoft.ru
А по ID группы нельзя в XSL получить ее путь?! Зачем усложнять себе жизнь и обрезать из пути элемента?
Дело в том, что в XML вообще не генерируется путь к группе.
Это получается следующим образом.
В информационной системе создано дополнительное свойство "Информационная система". Отмечаем дополнительное свойство у элемента (выбираешь группу и элемент в доп. свойстве). В результате в XML выдается информация только об элементе инф.системы:
Как еще можно определить путь к группе?
Это получается следующим образом.
В информационной системе создано дополнительное свойство "Информационная система". Отмечаем дополнительное свойство у элемента (выбираешь группу и элемент в доп. свойстве). В результате в XML выдается информация только об элементе инф.системы:
<item_propertys>
<item_property type="InformationSystemItem" xml_name="photos" parent_id="0" id="22">
<property_id>119</property_id>
<property_xml_name>photos</property_xml_name>
<property_name>Все фотографии</property_name>
<property_order>0</property_order>
<value>76</value>
<photos>76</photos>
<item id="76" group_id="13">
<item_date>26.12.2008
.......
<item_property type="InformationSystemItem" xml_name="photos" parent_id="0" id="22">
<property_id>119</property_id>
<property_xml_name>photos</property_xml_name>
<property_name>Все фотографии</property_name>
<property_order>0</property_order>
<value>76</value>
<photos>76</photos>
<item id="76" group_id="13">
<item_date>26.12.2008
.......
Как еще можно определить путь к группе?
Профессиональная разработка сайтов на HostCMS. Звоните: (843) 200-94-60, http://webinsoft.ru
fix,
Есть ID группы, а сверху массив групп у Вас не выводится? Хотя это другая ИС, и группы другие. Нужно подумать.
Есть ID группы, а сверху массив групп у Вас не выводится? Хотя это другая ИС, и группы другие. Нужно подумать.
нет, массив групп для этого доп. свойства не генерируется. Вот весь XML:
<?xml version="1.0" encoding="windows-1251"?>
<document>
<site_user_id>0</site_user_id>
<ОтображатьСсылкуНаАрхив>0</ОтображатьСсылкуНаАрхив>
<ОтображатьСсылкиНаСледующиеСтраницы>1</ОтображатьСсылкиНаСледующиеСтраницы>
<show_comments>0</show_comments>
<show_add_comments>0</show_add_comments>
<information_system id="16">
<name>Проекты</name>
<url>/projects/</url>
<description></description>
<captcha_used>1</captcha_used>
<captcha_key>50400</captcha_key>
<parent_group_id>10</parent_group_id>
</information_system>
<group id="9" parent_id="0">
<name>Текущие проекты</name>
<description></description>
<order>0</order>
<path>currents</path>
<fullpath>currents/</fullpath>
<access>-1</access>
<count_items>2</count_items>
<count_all_items>2</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<group id="10" parent_id="0">
<name>Реализованные проекты</name>
<description></description>
<order>0</order>
<path>latest</path>
<fullpath>latest/</fullpath>
<access>-1</access>
<count_items>1</count_items>
<count_all_items>1</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<group id="11" parent_id="0">
<name>Предложения</name>
<description></description>
<order>0</order>
<path>offers</path>
<fullpath>offers/</fullpath>
<access>-1</access>
<count_items>0</count_items>
<count_all_items>0</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<item id="66" group_id="10">
<item_date>14.09.2007</item_date>
<item_datetime>14.09.2007 15:22:14</item_datetime>
<item_time>15:22:14</item_time>
<item_putoff_date>14.09.2007 15:22:14</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>Проект</item_name>
<item_description>В&nbsp;нашей стране</item_description>
<part count="1">0</part>
<item_text><p>Как известно, 2008 год&nbsp;в&nbsp;России объявлен годом семьи.</item_text>
<item_image width="58" height="58">/upload/information_items_1230281385.gif</item_image>
<item_small_image width="58" height="58">/upload/small_information_items_1230281430.gif</item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/projects/latest/66/</item_path>
<item_path_field></item_path_field>
<item_show_count>31</item_show_count>
<item_propertys>
<item_property type="InformationSystemItem" xml_name="photos" parent_id="0" id="22">
<property_id>119</property_id>
<property_xml_name>photos</property_xml_name>
<property_name>Фотографии с проекта</property_name>
<property_order>0</property_order>
<value>76</value>
<photos>76</photos>
<item id="76" group_id="13">
<item_date>26.12.2008</item_date>
<item_datetime>26.12.2008 12:01:15</item_datetime>
<item_time>12:01:15</item_time>
<item_putoff_date>26.12.2008 12:01:15</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>После представления</item_name>
<item_description></item_description>
<item_text></item_text>
<item_image width="131" height="131">/upload/information_items_1230282085.jpg</item_image>
<item_small_image width="131" height="131">/upload/small_information_items_1230282085.jpg</item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/gallery/happychild/76/</item_path>
<item_path_field></item_path_field>
<item_show_count>9</item_show_count>
<item_propertys>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</item_property>
<item_property type="String" xml_name="resume_title" parent_id="0" id="17">
<property_id>102</property_id>
<property_xml_name>resume_title</property_xml_name>
<property_name>Заголовок резюме</property_name>
<property_order>10</property_order>
<resume_title>Помочь проекту</resume_title>
<value>Помочь проекту</value>
</item_property>
<item_property type="String" xml_name="link_resume_title" parent_id="0" id="18">
<property_id>103</property_id>
<property_xml_name>link_resume_title</property_xml_name>
<property_name>Ссылка заголовка резюме</property_name>
<property_order>20</property_order>
<link_resume_title>javascript:void(0);</link_resume_title>
<value>javascript:void(0);</value>
</item_property>
<item_property type="WYSIWYG" xml_name="resume" parent_id="0" id="19">
<property_id>104</property_id>
<property_xml_name>resume</property_xml_name>
<property_name>Резюме</property_name>
<property_order>30</property_order>
<resume></resume>
<value></value>
</item_property>
<item_property type="InformationSystemItem" xml_name="fraze" parent_id="0" id="21">
<property_id>106</property_id>
<property_xml_name>fraze</property_xml_name>
<property_name>Фраза</property_name>
<property_order>50</property_order>
<value>67</value>
<fraze>67</fraze>
<item id="67" group_id="12">
<item_date>14.09.2007</item_date>
<item_datetime>14.09.2007 16:32:04</item_datetime>
<item_time>16:32:04</item_time>
<item_putoff_date>14.09.2007 16:32:04</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>Счастливое детство</item_name>
<item_description><p>Ни один ребенок не может опозорить родителей так, как родитель - ребенка.</p>
<p><span style="font-size: xx-small;">Ян Курчаб</span></p></item_description>
<item_text></item_text>
<item_image width="0" height="0"></item_image>
<item_small_image width="0" height="0"></item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/dlja-proektov/67/</item_path>
<item_path_field></item_path_field>
<item_show_count>0</item_show_count>
<item_propertys>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</item_property>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</document>
<?xml version="1.0" encoding="windows-1251"?>
<document>
<site_user_id>0</site_user_id>
<ОтображатьСсылкуНаАрхив>0</ОтображатьСсылкуНаАрхив>
<ОтображатьСсылкиНаСледующиеСтраницы>1</ОтображатьСсылкиНаСледующиеСтраницы>
<show_comments>0</show_comments>
<show_add_comments>0</show_add_comments>
<information_system id="16">
<name>Проекты</name>
<url>/projects/</url>
<description></description>
<captcha_used>1</captcha_used>
<captcha_key>50400</captcha_key>
<parent_group_id>10</parent_group_id>
</information_system>
<group id="9" parent_id="0">
<name>Текущие проекты</name>
<description></description>
<order>0</order>
<path>currents</path>
<fullpath>currents/</fullpath>
<access>-1</access>
<count_items>2</count_items>
<count_all_items>2</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<group id="10" parent_id="0">
<name>Реализованные проекты</name>
<description></description>
<order>0</order>
<path>latest</path>
<fullpath>latest/</fullpath>
<access>-1</access>
<count_items>1</count_items>
<count_all_items>1</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<group id="11" parent_id="0">
<name>Предложения</name>
<description></description>
<order>0</order>
<path>offers</path>
<fullpath>offers/</fullpath>
<access>-1</access>
<count_items>0</count_items>
<count_all_items>0</count_all_items>
<count_groups>0</count_groups>
<count_all_groups>0</count_all_groups>
<allow_indexation>1</allow_indexation>
<propertys>
</propertys>
</group>
<item id="66" group_id="10">
<item_date>14.09.2007</item_date>
<item_datetime>14.09.2007 15:22:14</item_datetime>
<item_time>15:22:14</item_time>
<item_putoff_date>14.09.2007 15:22:14</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>Проект</item_name>
<item_description>В&nbsp;нашей стране</item_description>
<part count="1">0</part>
<item_text><p>Как известно, 2008 год&nbsp;в&nbsp;России объявлен годом семьи.</item_text>
<item_image width="58" height="58">/upload/information_items_1230281385.gif</item_image>
<item_small_image width="58" height="58">/upload/small_information_items_1230281430.gif</item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/projects/latest/66/</item_path>
<item_path_field></item_path_field>
<item_show_count>31</item_show_count>
<item_propertys>
<item_property type="InformationSystemItem" xml_name="photos" parent_id="0" id="22">
<property_id>119</property_id>
<property_xml_name>photos</property_xml_name>
<property_name>Фотографии с проекта</property_name>
<property_order>0</property_order>
<value>76</value>
<photos>76</photos>
<item id="76" group_id="13">
<item_date>26.12.2008</item_date>
<item_datetime>26.12.2008 12:01:15</item_datetime>
<item_time>12:01:15</item_time>
<item_putoff_date>26.12.2008 12:01:15</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>После представления</item_name>
<item_description></item_description>
<item_text></item_text>
<item_image width="131" height="131">/upload/information_items_1230282085.jpg</item_image>
<item_small_image width="131" height="131">/upload/small_information_items_1230282085.jpg</item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/gallery/happychild/76/</item_path>
<item_path_field></item_path_field>
<item_show_count>9</item_show_count>
<item_propertys>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</item_property>
<item_property type="String" xml_name="resume_title" parent_id="0" id="17">
<property_id>102</property_id>
<property_xml_name>resume_title</property_xml_name>
<property_name>Заголовок резюме</property_name>
<property_order>10</property_order>
<resume_title>Помочь проекту</resume_title>
<value>Помочь проекту</value>
</item_property>
<item_property type="String" xml_name="link_resume_title" parent_id="0" id="18">
<property_id>103</property_id>
<property_xml_name>link_resume_title</property_xml_name>
<property_name>Ссылка заголовка резюме</property_name>
<property_order>20</property_order>
<link_resume_title>javascript:void(0);</link_resume_title>
<value>javascript:void(0);</value>
</item_property>
<item_property type="WYSIWYG" xml_name="resume" parent_id="0" id="19">
<property_id>104</property_id>
<property_xml_name>resume</property_xml_name>
<property_name>Резюме</property_name>
<property_order>30</property_order>
<resume></resume>
<value></value>
</item_property>
<item_property type="InformationSystemItem" xml_name="fraze" parent_id="0" id="21">
<property_id>106</property_id>
<property_xml_name>fraze</property_xml_name>
<property_name>Фраза</property_name>
<property_order>50</property_order>
<value>67</value>
<fraze>67</fraze>
<item id="67" group_id="12">
<item_date>14.09.2007</item_date>
<item_datetime>14.09.2007 16:32:04</item_datetime>
<item_time>16:32:04</item_time>
<item_putoff_date>14.09.2007 16:32:04</item_putoff_date>
<item_putend_date>00.00.0000 00:00:00</item_putend_date>
<item_name>Счастливое детство</item_name>
<item_description><p>Ни один ребенок не может опозорить родителей так, как родитель - ребенка.</p>
<p><span style="font-size: xx-small;">Ян Курчаб</span></p></item_description>
<item_text></item_text>
<item_image width="0" height="0"></item_image>
<item_small_image width="0" height="0"></item_small_image>
<item_status>1</item_status>
<item_seo_title></item_seo_title>
<item_seo_description></item_seo_description>
<item_seo_keywords></item_seo_keywords>
<item_access>-1</item_access>
<item_path>/dlja-proektov/67/</item_path>
<item_path_field></item_path_field>
<item_show_count>0</item_show_count>
<item_propertys>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</item_property>
</item_propertys>
<item_comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
</item_comments>
</item>
</document>
Профессиональная разработка сайтов на HostCMS. Звоните: (843) 200-94-60, http://webinsoft.ru
XSL сразу покажите и укажите, гду нужно получить путь к группе.
Вот XSL шаблон:
Ссылку на группу нужно вывести на строке №90 ("Посмотреть фотографии с проекта"
<?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"/>
<h1>
<xsl:value-of disable-output-escaping="yes" select="item_name"/>
</h1>
<!-- Путь к группе -->
<div class="breadcrumb">
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
</div>
<!-- Выводим сообщение -->
<xsl:if test="/document/message/node()">
<h2><xsl:value-of disable-output-escaping="yes" select="/document/message"/></h2>
</xsl:if>
<!-- Фотогафия к информационному элементу -->
<xsl:if test="item_small_image!=''">
<!-- Проверяем задан ли путь к файлу большого изображения -->
<xsl:if test="item_image!=''">
<div class="pic">
<a href="{item_image}" target="blank_" onclick="ShowImgWindow('{item_name}','{item_image}', {item_image/@width}, {item_image/@height}); return false;">
<img align="left" src="{item_small_image}"/>
</a>
</div>
</xsl:if>
<xsl:if test="item_image =''">
<div class="pic">
<img align="left" src="{item_small_image}"/>
</div>
</xsl:if>
</xsl:if>
<xsl:if test="//group[@id = $parent_group_id]/propertys/property[@xml_name='big_text'] != ''">
<p>
<xsl:value-of disable-output-escaping="yes" select="//group[@id = $parent_group_id]/propertys/property[@xml_name='big_text']/value"/>
</p>
</xsl:if>
<!-- Текст информационного элемента -->
<p>
<xsl:value-of disable-output-escaping="yes" select="item_text"/>
</p>
<!-- Средняя оценка элемента -->
<xsl:if test="item_comments/average_grade/node() and item_comments/average_grade != 0">
<div style="float: left; margin: 0px 0px 0px 0px">Оценка: <xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="item_comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/></xsl:call-template></div>
<div style="clear: both"></div>
</xsl:if>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<!-- Дата информационного элемента -->
<p class="date"><xsl:value-of select="item_date"/>,
<!--
<xsl:value-of select="item_show_count"/> <xsl:call-template name="declension">
<xsl:with-param name="number" select="item_show_count"/>
</xsl:call-template>.
--></p>
<xsl:if test="count(item_propertys/item_property[@xml_name='photos']/item/item_path)">
<h3>Фотографии с проекта</h3>
<div class="pic">
<img src="{item_propertys/item_property[@xml_name='photos']/item/item_small_image}" alt="{item_name}" />
</div>
<div class="more_left photo">
<a href="{item_propertys/item_property[@xml_name='photos']/item/item_path}">Посмотреть фотографии</a>
</div>
</xsl:if>
<!-- Ссылка 1-2-3 на части документа -->
<xsl:if test="part/@count > 1">
<div class="read_more">Читать дальше:</div>
<xsl:call-template name="for">
<xsl:with-param name="items_on_page">1</xsl:with-param>
<xsl:with-param name="current_page" select="part"/>
<xsl:with-param name="link" select="/document/item/item_path"/>
<xsl:with-param name="count_items" select="part/@count"/>
<xsl:with-param name="visible_pages">6</xsl:with-param>
<xsl:with-param name="prefix">part</xsl:with-param>
</xsl:call-template>
<div style="clear: both"></div>
</xsl:if>
<xsl:if test="count(/document/properties_items_dir)">
<div style="margin: 10px 0px;">
<h2>Атрибуты элемента инфосистемы</h2>
<xsl:if test="count(/document/item/item_propertys/item_property[@parent_id = 0])">
<table border="0">
<xsl:apply-templates select="/document/item/item_propertys/item_property[@parent_id = 0]"/>
</table>
</xsl:if>
<xsl:apply-templates select="/document/properties_items_dir"/>
</div>
</xsl:if>
<!-- Если указано отображать комментарии -->
<xsl:if test="/document/show_comments/node() and /document/show_comments = 1">
<!-- Отображение комментариев -->
<xsl:if test="count(item_comments/comment) > 0">
<p class="title">
<a name="comments"></a>Комментарии</p>
<xsl:apply-templates select="item_comments/comment"/>
</xsl:if>
</xsl:if>
<!-- Если разрешено отображать формы добавления комментария
1 - Только авторизированным
2 - Всем -->
<xsl:if test="/document/show_add_comments/node() and ((/document/show_add_comments = 1 and /document/site_user_id > 0) or /document/show_add_comments = 2)">
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment')">Добавить комментарий</a>
</div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tags/tag">
<a href="{/document/information_system/url}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()">,</xsl:if> 
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for_star">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<!--
<input type="radio" name="_comment_grade" value="{$i}" id="id_comment_grade_{$i}"/> 
<label for="id_icomment_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
-->
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for_star">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Вывод рейтинга -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:otherwise>
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent_id"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent_id=0">
<a href="{/document/information_system/url}">
<xsl:value-of disable-output-escaping="yes" select="/document/information_system/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<a href="{/document/information_system/url}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
<!-- Отображение комментариев -->
<xsl:template match="comment">
<!-- Отображаем комментарий, если задан текст или тема комментария -->
<xsl:if test="comment_text != '' or comment_subject != ''">
<a name="comment{comment_id}"></a>
<div class="comment" id="comment{comment_id}">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="comment_subject != ''">
<div>
<strong>
<xsl:value-of select="comment_subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="comment_text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="comment_grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comment_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<!-- Комментарий добавил авторизированный пользователь -->
<xsl:when test="site_user_login/node()">
<a href="/users/info/{site_user_login}/" class="c_u_l">
<xsl:value-of select="site_user_login"/>
</a> · <xsl:value-of select="comment_datetime"/>
</xsl:when>
<!-- Комментарй добавил неавторизированный пользователь -->
<xsl:otherwise>
<xsl:value-of select="comment_fio"/> · <xsl:value-of select="comment_date"/></xsl:otherwise>
</xsl:choose> · <xsl:if
test="/document/show_add_comments/node()
and ((/document/show_add_comments = 1 and /document/site_user_id > 0)
or /document/show_add_comments = 2)"><a href="javascript:cr('cr_{comment_id}');">ответить</a> · </xsl:if><a href="{/document/item/item_path}#comment{comment_id}" title="ссылка">#</a>
</div>
<!-- Отображаем только авторизированным пользователям -->
<xsl:if test="/document/show_add_comments/node() and ((/document/show_add_comments = 1 and /document/site_user_id > 0) or /document/show_add_comments = 2)">
<div class="cr" id="cr_{comment_id}">
<xsl:call-template name="AddCommentForm">
<xsl:with-param name="comment_id" select="comment_id"/>
</xsl:call-template>
</div>
</xsl:if>
<!-- Выбираем дочерние комментарии -->
<xsl:if test="count(comment) > 0">
<div class="csd">
<xsl:apply-templates select="comment"/>
</div>
</xsl:if>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит группы свойств для элемента инфосистемы -->
<xsl:template match="properties_items_dir">
<p><b><xsl:value-of select="information_propertys_items_dir_name"/></b></p>
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/document/item/item_propertys/item_property[@parent_id = $dir_id])">
<table border="0">
<xsl:apply-templates select="/document/item/item_propertys/item_property[@parent_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir)">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="item_property">
<tr>
<td style="padding: 5px" bgcolor="#E5DFDA">
<b><xsl:value-of select="property_name"/></b>
</td>
<td style="padding: 5px" bgcolor="#E5DFDA">
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/document/site_user_id = 0">
Имя
<br/>
<input type="text" size="70" name="comment_autor" value=""/>
<p>
E-mail
<br/>
<input type="text" size="70" name="comment_email" value=""/>
</p>
<p>
Тема
<br/>
<input type="text" size="70" name="comment_subject" value=""/>
</p>
</xsl:if>
<p>
Комментарий
<br/>
<textarea name="comment_text" cols="68" rows="5" class="mceEditor"></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="comment_grade" value="0"/>
<ul id="0{comment_id}_stars" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}1"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}2"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}3"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}4"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}5"></li>
</ul>
<br/>
<!--
<xsl:call-template name="for_star">
<xsl:with-param name="n" select="5"/>
</xsl:call-template>
-->
</p>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /document/site_user_id = 0">
<p>
Код подтверждения
<br/>
<div style="float: left">
<img style="border: 1px solid #777777" src="/captcha.php?get_captcha={//captcha_key}&height=28" title="Код подтверждения"/>
</div>
<div style="float: left; margin-left: 10px; margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div style="clear: both"></div>
</p>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input type="submit" name="add_comment" value="Опубликовать"/>
</p>
</form>
</div>
</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 > ($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 > $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 > $items_on_page and $n > $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 > 0 and $i = 0">
<a href="{$link}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<xsl:choose>
<xsl:when test="$i >= ($current_page - $pre_count_page) and ($current_page + $post_count_page) >= $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 >= $n and $n > ($current_page + 1 + $post_count_page)">
<xsl:choose>
<xsl:when test="$n > round($n)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">→</a>
</xsl:when>
<xsl:otherwise>
<a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">→</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>
<!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"/>
<h1>
<xsl:value-of disable-output-escaping="yes" select="item_name"/>
</h1>
<!-- Путь к группе -->
<div class="breadcrumb">
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
</div>
<!-- Выводим сообщение -->
<xsl:if test="/document/message/node()">
<h2><xsl:value-of disable-output-escaping="yes" select="/document/message"/></h2>
</xsl:if>
<!-- Фотогафия к информационному элементу -->
<xsl:if test="item_small_image!=''">
<!-- Проверяем задан ли путь к файлу большого изображения -->
<xsl:if test="item_image!=''">
<div class="pic">
<a href="{item_image}" target="blank_" onclick="ShowImgWindow('{item_name}','{item_image}', {item_image/@width}, {item_image/@height}); return false;">
<img align="left" src="{item_small_image}"/>
</a>
</div>
</xsl:if>
<xsl:if test="item_image =''">
<div class="pic">
<img align="left" src="{item_small_image}"/>
</div>
</xsl:if>
</xsl:if>
<xsl:if test="//group[@id = $parent_group_id]/propertys/property[@xml_name='big_text'] != ''">
<p>
<xsl:value-of disable-output-escaping="yes" select="//group[@id = $parent_group_id]/propertys/property[@xml_name='big_text']/value"/>
</p>
</xsl:if>
<!-- Текст информационного элемента -->
<p>
<xsl:value-of disable-output-escaping="yes" select="item_text"/>
</p>
<!-- Средняя оценка элемента -->
<xsl:if test="item_comments/average_grade/node() and item_comments/average_grade != 0">
<div style="float: left; margin: 0px 0px 0px 0px">Оценка: <xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="item_comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/></xsl:call-template></div>
<div style="clear: both"></div>
</xsl:if>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<!-- Дата информационного элемента -->
<p class="date"><xsl:value-of select="item_date"/>,
<!--
<xsl:value-of select="item_show_count"/> <xsl:call-template name="declension">
<xsl:with-param name="number" select="item_show_count"/>
</xsl:call-template>.
--></p>
<xsl:if test="count(item_propertys/item_property[@xml_name='photos']/item/item_path)">
<h3>Фотографии с проекта</h3>
<div class="pic">
<img src="{item_propertys/item_property[@xml_name='photos']/item/item_small_image}" alt="{item_name}" />
</div>
<div class="more_left photo">
<a href="{item_propertys/item_property[@xml_name='photos']/item/item_path}">Посмотреть фотографии</a>
</div>
</xsl:if>
<!-- Ссылка 1-2-3 на части документа -->
<xsl:if test="part/@count > 1">
<div class="read_more">Читать дальше:</div>
<xsl:call-template name="for">
<xsl:with-param name="items_on_page">1</xsl:with-param>
<xsl:with-param name="current_page" select="part"/>
<xsl:with-param name="link" select="/document/item/item_path"/>
<xsl:with-param name="count_items" select="part/@count"/>
<xsl:with-param name="visible_pages">6</xsl:with-param>
<xsl:with-param name="prefix">part</xsl:with-param>
</xsl:call-template>
<div style="clear: both"></div>
</xsl:if>
<xsl:if test="count(/document/properties_items_dir)">
<div style="margin: 10px 0px;">
<h2>Атрибуты элемента инфосистемы</h2>
<xsl:if test="count(/document/item/item_propertys/item_property[@parent_id = 0])">
<table border="0">
<xsl:apply-templates select="/document/item/item_propertys/item_property[@parent_id = 0]"/>
</table>
</xsl:if>
<xsl:apply-templates select="/document/properties_items_dir"/>
</div>
</xsl:if>
<!-- Если указано отображать комментарии -->
<xsl:if test="/document/show_comments/node() and /document/show_comments = 1">
<!-- Отображение комментариев -->
<xsl:if test="count(item_comments/comment) > 0">
<p class="title">
<a name="comments"></a>Комментарии</p>
<xsl:apply-templates select="item_comments/comment"/>
</xsl:if>
</xsl:if>
<!-- Если разрешено отображать формы добавления комментария
1 - Только авторизированным
2 - Всем -->
<xsl:if test="/document/show_add_comments/node() and ((/document/show_add_comments = 1 and /document/site_user_id > 0) or /document/show_add_comments = 2)">
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment')">Добавить комментарий</a>
</div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tags/tag">
<a href="{/document/information_system/url}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()">,</xsl:if> 
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for_star">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<!--
<input type="radio" name="_comment_grade" value="{$i}" id="id_comment_grade_{$i}"/> 
<label for="id_icomment_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
-->
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for_star">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Вывод рейтинга -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:otherwise>
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent_id"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent_id=0">
<a href="{/document/information_system/url}">
<xsl:value-of disable-output-escaping="yes" select="/document/information_system/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<a href="{/document/information_system/url}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
<!-- Отображение комментариев -->
<xsl:template match="comment">
<!-- Отображаем комментарий, если задан текст или тема комментария -->
<xsl:if test="comment_text != '' or comment_subject != ''">
<a name="comment{comment_id}"></a>
<div class="comment" id="comment{comment_id}">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="comment_subject != ''">
<div>
<strong>
<xsl:value-of select="comment_subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="comment_text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="comment_grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comment_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<!-- Комментарий добавил авторизированный пользователь -->
<xsl:when test="site_user_login/node()">
<a href="/users/info/{site_user_login}/" class="c_u_l">
<xsl:value-of select="site_user_login"/>
</a> · <xsl:value-of select="comment_datetime"/>
</xsl:when>
<!-- Комментарй добавил неавторизированный пользователь -->
<xsl:otherwise>
<xsl:value-of select="comment_fio"/> · <xsl:value-of select="comment_date"/></xsl:otherwise>
</xsl:choose> · <xsl:if
test="/document/show_add_comments/node()
and ((/document/show_add_comments = 1 and /document/site_user_id > 0)
or /document/show_add_comments = 2)"><a href="javascript:cr('cr_{comment_id}');">ответить</a> · </xsl:if><a href="{/document/item/item_path}#comment{comment_id}" title="ссылка">#</a>
</div>
<!-- Отображаем только авторизированным пользователям -->
<xsl:if test="/document/show_add_comments/node() and ((/document/show_add_comments = 1 and /document/site_user_id > 0) or /document/show_add_comments = 2)">
<div class="cr" id="cr_{comment_id}">
<xsl:call-template name="AddCommentForm">
<xsl:with-param name="comment_id" select="comment_id"/>
</xsl:call-template>
</div>
</xsl:if>
<!-- Выбираем дочерние комментарии -->
<xsl:if test="count(comment) > 0">
<div class="csd">
<xsl:apply-templates select="comment"/>
</div>
</xsl:if>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит группы свойств для элемента инфосистемы -->
<xsl:template match="properties_items_dir">
<p><b><xsl:value-of select="information_propertys_items_dir_name"/></b></p>
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/document/item/item_propertys/item_property[@parent_id = $dir_id])">
<table border="0">
<xsl:apply-templates select="/document/item/item_propertys/item_property[@parent_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir)">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="item_property">
<tr>
<td style="padding: 5px" bgcolor="#E5DFDA">
<b><xsl:value-of select="property_name"/></b>
</td>
<td style="padding: 5px" bgcolor="#E5DFDA">
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/document/site_user_id = 0">
Имя
<br/>
<input type="text" size="70" name="comment_autor" value=""/>
<p>
<br/>
<input type="text" size="70" name="comment_email" value=""/>
</p>
<p>
Тема
<br/>
<input type="text" size="70" name="comment_subject" value=""/>
</p>
</xsl:if>
<p>
Комментарий
<br/>
<textarea name="comment_text" cols="68" rows="5" class="mceEditor"></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="comment_grade" value="0"/>
<ul id="0{comment_id}_stars" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}1"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}2"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}3"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}4"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}5"></li>
</ul>
<br/>
<!--
<xsl:call-template name="for_star">
<xsl:with-param name="n" select="5"/>
</xsl:call-template>
-->
</p>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /document/site_user_id = 0">
<p>
Код подтверждения
<br/>
<div style="float: left">
<img style="border: 1px solid #777777" src="/captcha.php?get_captcha={//captcha_key}&height=28" title="Код подтверждения"/>
</div>
<div style="float: left; margin-left: 10px; margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div style="clear: both"></div>
</p>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input type="submit" name="add_comment" value="Опубликовать"/>
</p>
</form>
</div>
</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 > ($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 > $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 > $items_on_page and $n > $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 > 0 and $i = 0">
<a href="{$link}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<xsl:choose>
<xsl:when test="$i >= ($current_page - $pre_count_page) and ($current_page + $post_count_page) >= $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 >= $n and $n > ($current_page + 1 + $post_count_page)">
<xsl:choose>
<xsl:when test="$n > round($n)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">→</a>
</xsl:when>
<xsl:otherwise>
<a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">→</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>
Ссылку на группу нужно вывести на строке №90 ("Посмотреть фотографии с проекта"

Профессиональная разработка сайтов на HostCMS. Звоните: (843) 200-94-60, http://webinsoft.ru
Авторизация