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="/shop">
      <xsl:apply-templates select="item"/>
   </xsl:template>
   
   <xsl:template match="item">
      
      <h1>
         <xsl:value-of disable-output-escaping="yes" select="name"/>
      </h1>
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
      
      <p>
         <xsl:if test="$parent_group_id = 0">
            <a href="{/shop/path}">
               <xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
            </a>
         </xsl:if>
         
         <!-- Путь к группе -->
         <xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
         
         <!-- Если модификация, выводим в пути родительский товар -->
         <xsl:if test="/shop/parent_item/node()">
            <span class="path_arrow">&#x2192;</span>
            <a href="{/shop/path}{/shop/parent_item/item/fullpath}{/shop/parent_item/item/path}/">
               <xsl:value-of disable-output-escaping="yes" select="/shop/parent_item/item/name"/>
            </a>
         </xsl:if>
         
         <span class="path_arrow">&#x2192;</span>
         <b>
            <a href="{/path}">
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
         </b>
      </p>
      
      <!-- Средняя оценка товара -->
      <xsl:if test="comments/average_grade/node()">
         <div style="float: left; margin: 20px 0px 0px 20px">
            <xsl:call-template name="show_average_grade">
               <xsl:with-param name="grade" select="comments/average_grade"/>
               <xsl:with-param name="const_grade" select="5"/>
            </xsl:call-template>
         </div>
         <div style="clear: both"></div>
      </xsl:if>
      
      <!-- Информация об ошибках -->
      <xsl:variable name="error_code" select="/shop/error"/>
      
      <xsl:if test="$error_code != 0">
         <div id="error">
         <b>Внимание!</b>Неправильно введен код подтвержения!</div>
      </xsl:if>
      
      <xsl:if test="not(/shop/error/node()) and /shop/comment_is_active/node()">
         <!-- Информация о выполненном действии -->
         <div id="message">
            <xsl:choose>
               <xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
               <xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
            </xsl:choose>
         </div>
      </xsl:if>
      
      <div>
         <!-- Изображение для товара, если есть -->
         <xsl:if test="small_image != ''">
            <div id="gallery" style="float: left; width: {small_image/@width}px; margin: 0px 10px 10px 0px;">
               <a href="{image}" target="_blank">
                  <img src="{small_image}" class="image" />
               </a>
               <table border="0">
                  <xsl:apply-templates select="property[@dir_id = 0 and (substring-after(file_path, '.') = 'gif' or substring-after(file_path, '.') = 'bmp' or substring-after(file_path, '.') = 'png' or substring-after(file_path, '.') = 'ico' or substring-after(file_path, '.') = 'jpg' or substring-after(file_path, '.') = 'jpeg')]"/>
               </table>
            </div>
         </xsl:if>
         
         <!-- Цена товара -->
         <p>Цена:
            <span style="font-size: 11pt; font-weight: bold">
               <xsl:choose>
                  <xsl:when test="price_discount != 0">
                     <xsl:value-of select="format-number(price_discount, '### ##0,00', 'my')"/>&#xA0;<xsl:value-of select="currency" disable-output-escaping="yes"/>
                  </xsl:when>
                  <xsl:otherwise>договорная</xsl:otherwise>
               </xsl:choose>
            </span>
            <br/>
            
            <!-- Если цена со скидкой - выводим ее -->
            <xsl:if test="price_tax != price_discount">
               <span style="color: gray; text-decoration: line-through;">
                  <xsl:variable name="price_tax" select="price_tax"/>
                  <span style="font-size: 11pt">
                     <xsl:value-of select="format-number($price_tax, '### ##0,00', 'my')"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/></span>
               </span>
               <br/>
            </xsl:if>
         </p>
         
         <!-- Ссылку на добавление в корзины выводим, если:
         type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
         type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
         что означает неограниченное количество -->
         <xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
            <p>
               <input type="text" size="3" value="1" id="count_{@id}"/>
               <img src="/images/map_intocart.gif" width="12" height="21" border="0" usemap="#mapInToCart{@id}" style="margin: 0 0 -6px 1px;"/><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="/hostcmsfiles/images/cart.gif" style="margin: 0px 0px -4px 10px" /></a>
               <map name="mapInToCart{@id}">
                  <area shape="rect" coords="0,0,12,10"  onclick="set_count_mod('count_{@id}', 1);" nohref="nohref" />
                  <area shape="rect" coords="0,11,12,21" onclick="set_count_mod('count_{@id}', -1);" nohref="nohref" />
               </map>
               
            </p>
         </xsl:if>
         
         <xsl:if test="marking_of_goods != ''">
         <p>Артикул: <b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p>
         </xsl:if>
         
         <xsl:if test="producer/shop_producers_list_name != ''">
         <p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></b></p>
         </xsl:if>
         
         <!-- Если указан вес товара -->
         <xsl:if test="weight != 0">
            <p>Вес товара: <xsl:value-of select="weight"/>&#xA0;<xsl:value-of select="weight_mesure"/></p>
         </xsl:if>
         
         <!-- Показываем скидки -->
         <xsl:if test="count(discount) &gt; 0">
            <xsl:apply-templates select="discount"/>
         </xsl:if>
         
         <!-- Показываем количество на складе, если больше нуля -->
         <xsl:if test="rest &gt; 0">
            <p>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="mesure"/></p>
         </xsl:if>
         
         <!-- Описание товара -->
         <xsl:value-of disable-output-escaping="yes" select="description" />
         
         <!-- Если электронный товар, выведим доступное количество -->
         <xsl:if test="type = 1">
            <p>
               <strong>
                  <xsl:choose>
                     <xsl:when test="eitem_count = 0">
                        Электронный товар закончился.
                     </xsl:when>
                     <xsl:when test="eitem_count = -1">
                        Электронный товар доступен для заказа.
                     </xsl:when>
                     <xsl:otherwise>
                     На складе осталось: <xsl:value-of select="eitem_count" /><xsl:text> </xsl:text><xsl:value-of select="mesure" />
                     </xsl:otherwise>
                  </xsl:choose>
               </strong>
            </p>
         </xsl:if>
         
         <!-- Текст товара -->
         <p>
            <xsl:value-of disable-output-escaping="yes" select="text"/>
         </p>
         
         <div style="clear: both;"></div>
         
         <xsl:if test="count(property) > 0">
            <h2>Атрибуты товара</h2>
            
            <!-- Свойства в корневой группе -->
            <xsl:if test="count(property[@dir_id = 0 and not(substring-after(file_path, '.') = 'gif' or substring-after(file_path, '.') = 'bmp' or substring-after(file_path, '.') = 'png' or substring-after(file_path, '.') = 'ico' or substring-after(file_path, '.') = 'jpg' or substring-after(file_path, '.') = 'jpeg')])">
               <table border="0">
                  <xsl:apply-templates select="property[@dir_id = 0 and not(substring-after(file_path, '.') = 'gif' or substring-after(file_path, '.') = 'bmp' or substring-after(file_path, '.') = 'png' or substring-after(file_path, '.') = 'ico' or substring-after(file_path, '.') = 'jpg' or substring-after(file_path, '.') = 'jpeg')]"/>
               </table>
            </xsl:if>
            
            <!-- Выбираем список групп свойств -->
            <xsl:apply-templates select="/shop/properties_items_dir"/>
         </xsl:if>
      </div>
      
      <!-- Тэги для информационного элемента -->
      <xsl:if test="count(tags/tag) &gt; 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>
      
      <!-- Модификации -->
      <xsl:if test="count(modifications/item) &gt; 0">
         <b>Модификации:</b>
         <table cellspacing="3" cellpadding="3" style="margin-left: -6px;">
            <tr>
               <td style="border-bottom: 1px solid #dadada;">Название</td>
               <td style="border-bottom: 1px solid #dadada;">Цена</td>
            </tr>
            <xsl:apply-templates select="modifications/item"/>
         </table>
      </xsl:if>
      
      <xsl:if test="count(tying/item) &gt; 0">
         <p>
            <b>Сопутствующие товары:</b>
         </p>
         <!-- Отображаем сопутствующие товары -->
         <xsl:apply-templates select="tying/item"/>
         <div style="clear: both;"></div>
      </xsl:if>
      
      <!-- Отзывы о товаре -->
      <xsl:if test="count(comments/comment) &gt; 0">
         <p class="title">
         <a name="comments"></a>Отзывы о товаре</p>
         <xsl:apply-templates select="comments/comment" />
      </xsl:if>
      
      <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:template>
   
   <!-- Шаблон вывода добавления комментария -->
   <xsl:template name="AddCommentForm">
      <xsl:param name="comment_id" select="0"/>
      
      <!-- Заполняем форму -->
      <xsl:variable name="subject">
         <xsl:if test="/document/form_parent_id/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
            <xsl:value-of select="/document/form_subject"/>
         </xsl:if>
      </xsl:variable>
      <xsl:variable name="email">
         <xsl:if test="/document/form_user_email/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
            <xsl:value-of select="/document/form_user_email"/>
         </xsl:if>
      </xsl:variable>
      <xsl:variable name="text">
         <xsl:if test="/document/form_text/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
            <xsl:value-of disable-output-escaping="yes" select="/document/form_text"/>
         </xsl:if>
      </xsl:variable>
      <xsl:variable name="name">
         <xsl:if test="/document/form_user_name/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
            <xsl:value-of select="/document/form_user_name"/>
         </xsl:if>
      </xsl:variable>
      
      <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="/shop/user_id = 0">
               
               Имя
               <br/>
               <input type="text" size="70" name="shop_comment_user_name" value="{/shop/shop_comment_user_name}"/>
               
               <p>
                  E-mail
                  <br/>
                  <input id="email{$comment_id}" type="text" size="70" name="shop_comment_user_email" value="{/shop/shop_comment_user_email}"
                     onblur="FieldCheckEmail(this.id)"
                     onkeyup="FieldCheckEmail(this.id)"
                     onkeydown="FieldCheckEmail(this.id)" />
                  <div id="error_email{$comment_id}"></div>
               </p>
            </xsl:if>
            
            <p>
               Тема
               <br/>
               <input type="text" size="70" name="shop_comment_subject" value="{/shop/shop_comment_subject}"/>
            </p>
            
            <p>
               Комментарий
               <br/>
               <textarea name="shop_comment_text" cols="68" rows="5" class="mceEditor"><xsl:value-of select="/shop/shop_comment_text"/></textarea>
            </p>
            
            <p>
               Оценка
               <br/>
               <input type="hidden" name="shop_comment_grade" value="0"/>
               
               <xsl:variable name="ul_id">
                  <xsl:choose>
                     <xsl:when test="comment_id > 0"><xsl:value-of select="comment_id"/>_stars</xsl:when>
                     <xsl:otherwise>0_stars</xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
               
               <ul id="{$ul_id}" 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_star_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_star_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_star_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_star_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_star_5"></li>
               </ul>
            </p>
            
            <br/>
            
            <!-- Обработка CAPTCHA -->
            <xsl:if test="//captcha_key != 0 and /shop/user_id = 0">
               
               <p>Контрольные цифры
                  <sup>
                     <font color="red">*</font>
               </sup></p>
               
               <div style="float: left">
                  <img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&amp;height=30&amp;width=100" title="Код подтверждения" name="captcha"/>
               </div>
               
               <div id="captcha" style="clear:both;">
                  <img style="border: 0px" src="/hostcmsfiles/images/refresh.gif" /> <a href="javascript:void(0);" onclick="ReNewCaptchaById('comment_{$comment_id}', '{//captcha_key}{$comment_id}', 30); return false;">Показать другое число</a>
               </div>
               
               <div style="float: left;margin-top: 5px">
                  <input type="hidden" name="captcha_key" value="{//captcha_key}{$comment_id}"/>
                  <input type="text" name="captcha_keystring" size="15"/>
               </div>
               
               <div id="captcha" style="clear:both;margin-bottom:10px;">
                  Введите число, которое указано выше.
               </div>
            </xsl:if>
            
            <xsl:if test="$comment_id != 0">
               <input type="hidden" name="comment_parent_id" value="{comment_id}"/>
            </xsl:if>
            
            <p>
               <input id="submit_email{$comment_id}" type="submit" name="submit_comment" value="Опубликовать"/>
            </p>
         </form>
      </div>
   </xsl:template>
   
   <!-- Вывод раздела для свойств товара -->
   <xsl:template match="properties_items_dir">
      
      <xsl:variable name="dir_id" select="@id"/>
      
      <xsl:if test="count(/shop/item/property[@dir_id = $dir_id])">
         <!-- Название группы свойств -->
      <p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
         
         <table border="0">
            <xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
         </table>
      </xsl:if>
      
      <xsl:if test="count(properties_items_dir) > 0">
         <blockquote>
            <xsl:apply-templates select="properties_items_dir"/>
         </blockquote>
      </xsl:if>
   </xsl:template>
   
   <!-- Вывод строки со значением свойства -->
   <xsl:template match="property">
      <xsl:if test="value != '' or (type = 1 and file_path != '')">
         <tr>
            <td style="padding: 5px" bgcolor="#eeeeee">
               <b><xsl:value-of select="name"/></b>
            </td>
            <td style="padding: 5px" bgcolor="#eeeeee">
               <xsl:choose>
                  <xsl:when test="type = 1">
                     <!-- Определение типа файла -->
                     <xsl:variable name="sub_str">
                        <xsl:value-of select="substring-after(file_path, '.')" />
                     </xsl:variable>
                     
                     <xsl:choose>
                        <xsl:when test="$sub_str = 'gif' or $sub_str = 'bmp' or $sub_str = 'png' or $sub_str = 'ico' or $sub_str = 'jpg' or $sub_str = 'jpeg'">
                           <xsl:if test="small_image/file_path != ''">
                              <a href="{file_path}" target="_blank">
                                 <img src="{small_image/file_path}" class="image" />
                              </a>
                           </xsl:if>
                        </xsl:when>
                        <xsl:otherwise>
                           <a href="{file_path}">Скачать файл</a>
                        </xsl:otherwise>
                     </xsl:choose>
                     
                  </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:if>
   </xsl:template>
   
   <!-- /// Метки для информационного элемента /// -->
   <xsl:template match="tags/tag">
      <a href="{/shop/path}tag/{tag_path_name}/" class="tag">
         <xsl:value-of select="tag_name"/>
      </a>
   <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
   </xsl:template>
   
   <!-- Шаблон для модификаций -->
   <xsl:template match="modifications/item">
      <tr>
         <td>
            <!-- Название модификации -->
            <a href="{/shop/path}{fullpath}{path}/">
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
         </td>
         <td>
            <!-- Цена модификации -->
            <xsl:value-of disable-output-escaping="yes" select="price_discount"/>&#xA0;
            <!-- Валюта -->
            <xsl:value-of disable-output-escaping="yes" select="currency"/>
         </td>
      </tr>
   </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 &gt; ceiling($current_grade))">
            
            <xsl:if test="$current_grade - 1 &gt; 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 &gt; ceiling($current_grade))">
            
            <xsl:if test="$current_grade - 0.5 &gt; 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 name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="n"/>
      
      <input type="radio" name="shop_comment_grade" value="{$i}" id="id_shop_comment_grade_{$i}">
         <xsl:if test="/shop/shop_comment_grade = $i">
            <xsl:attribute name="checked">
            </xsl:attribute>
         </xsl:if>
      </input>&#xA0;
      <label for="id_shop_comment_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 &gt; $i and $n &gt; 1">
         <xsl:call-template name="for">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="n" select="$n"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <!-- Шаблон для отзывов -->
   <xsl:template match="comments/comment">
      <a name="comment{@id}"></a>
      <div class="comment">
         <div class="tl"></div>
         <div class="tr"></div>
         <div class="bl"></div>
         <div class="br"></div>
         
         <xsl:if test="subject != ''">
            <div>
               <strong>
                  <xsl:value-of select="subject"/>
               </strong>
            </div>
         </xsl:if>
         
         <xsl:value-of select="text" disable-output-escaping="yes"/>
         
         <!-- Оценка комментария -->
         <xsl:if test="grade != 0">
            <div>Оценка:
               <xsl:call-template name="show_average_grade">
                  <xsl:with-param name="grade" select="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="user_name">
               <xsl:value-of select="user_name"/>
            </xsl:when>
            <xsl:otherwise>
               <img src="/hostcmsfiles/images/user.gif"  style="margin: 0px 5px -4px 0px" />
               <b>
                  <a href="/users/info/{site_user_login}/"  class="c_u_l" ><xsl:value-of select="site_user_login"/></a>
               </b>
            </xsl:otherwise>
      </xsl:choose>&#xA0;·&#xA0;<xsl:value-of select="date_time"/>&#xA0;·&#xA0;<a href="{/shop/path}{/shop/item/fullpath}{/shop/item/path}/#comment{@id}" title="ссылка">#</a>
      </div>
   </xsl:template>
   
   <!-- Шаблон для скидки -->
   <xsl:template match="discount">
      <p>
         <xsl:value-of disable-output-escaping="yes" select="name"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="value"/>%
      </p>
   </xsl:template>
   
   <xsl:template match="tying/item">
      
      <div style="clear: both">
         <p>
            <a href="{/shop/path}{fullpath}{path}/">
               <xsl:value-of select="name"/>
            </a>
         </p>
         
         <!-- Изображение для товара, если есть -->
         <xsl:if test="small_image != ''">
            <a href="{/shop/path}{fullpath}{path}/">
               <img src="{small_image}" align="left" style="border: 1px solid #000000; margin: 0px 5px 5px 0px"/>
            </a>
         </xsl:if>
         
         <p>
            <xsl:value-of disable-output-escaping="yes" select="description"/>
         </p>
         
         <!-- Цена товара -->
         <strong>
            <xsl:choose>
               <xsl:when test="price_discount != 0">
                  <xsl:value-of disable-output-escaping="yes" select="price_discount"/>&#xA0;
                  <!-- Валюта товара -->
                  <xsl:value-of disable-output-escaping="yes" select="currency"/>
               </xsl:when>
               <xsl:otherwise>договорная</xsl:otherwise>
            </xsl:choose>
         </strong>
         
         <!-- Если цена со скидкой - выводим ее -->
         <xsl:if test="price_tax != price_discount">
            <br/>
            <font color="gray">
               <strike>
                  <xsl:value-of disable-output-escaping="yes" select="price_tax"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/></strike>
            </font>
         </xsl:if>
         
         <!-- Если указан вес товара -->
         <xsl:if test="weight != 0">
            <br/>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></xsl:if>
         
         <!-- Показываем скидки -->
         <xsl:if test="count(discount) &gt; 0">
            <xsl:apply-templates select="discount"/>
         </xsl:if>
         
         <!-- Показываем количество на складе, если больше нуля -->
         <xsl:if test="rest &gt; 0">
            <br/>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/></xsl:if>
         
         <xsl:if test="producer/shop_producers_list_name != ''">
            <br/>Производитель: <xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></xsl:if>
      </div>
   </xsl:template>
   
   <!-- Шаблон выводит хлебные крошки -->
   <xsl:template match="group" mode="goup_path">
      <xsl:variable name="parent_id" select="@parent"/>
      
      <!-- Выбираем рекурсивно вышестоящую группу -->
      <xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
      
      <xsl:if test="@parent=0">
         <a href="{/shop/path}">
            <xsl:value-of select="/shop/name"/>
         </a>
      </xsl:if>
      
      <span class="path_arrow">&#x2192;</span>
      
      <a href="{/shop/path}{fullpath}">
         <xsl:value-of select="name"/>
      </a>
   </xsl:template>
</xsl:stylesheet>
Авторизация