Меню:(

Модератор
#
Re: Меню:(
Предоставьте XML для меню.
#
Re: Меню:(
Вот XML меню:

<?xml version="1.0" encoding="windows-1251"?>
<document>
<structure id="69" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>Главная</name>
<show>1</show>
<show_link>1</show_link>
<level>0</level>
<id_parent>0</id_parent>
<is_external_link>1</is_external_link>
<external_link>/</external_link>
<link>/glavnay/</link>
<structure id="70" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>1 Подраздел первого уровня 1</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>69</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/glavnay/1_podrazdel_pervogo_urovnja_1/</link>
<propertys>
</propertys>
</structure>
<structure id="71" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>1 Подраздел первого уровня 2</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>69</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/glavnay/1_podrazdel_pervogo_urovnja_2/</link>
<propertys>
</propertys>
</structure>
<structure id="72" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>1 Подраздел первого уровня 3</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>69</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/glavnay/1_podrazdel_pervogo_urovnja_3/</link>
<propertys>
</propertys>
</structure>
<structure id="73" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>1 Подраздел первого уровня 4</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>69</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/glavnay/1_podrazdel_pervogo_urovnja_4/</link>
<propertys>
</propertys>
</structure>
<propertys>
</propertys>
</structure>
<structure id="66" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>Партнеры</name>
<show>1</show>
<show_link>1</show_link>
<level>0</level>
<id_parent>0</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/partnery/</link>
<structure id="74" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>2 Подраздел первого уровня 1</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>66</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/partnery/2_podrazdel_pervogo_urovnja_1/</link>
<propertys>
</propertys>
</structure>
<structure id="75" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>2 Подраздел первого уровня 2</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>66</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/partnery/2_podrazdel_pervogo_urovnja_2/</link>
<propertys>
</propertys>
</structure>
<structure id="76" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>2 Подраздел первого уровня 3</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>66</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/partnery/2_podrazdel_pervogo_urovnja_3/</link>
<propertys>
</propertys>
</structure>
<structure id="77" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>2 Подраздел первого уровня 4</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>66</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/partnery/2_podrazdel_pervogo_urovnja_4/</link>
<propertys>
</propertys>
</structure>
<propertys>
</propertys>
</structure>
<structure id="65" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>О федерации</name>
<show>1</show>
<show_link>1</show_link>
<level>0</level>
<id_parent>0</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/about/</link>
<structure id="78" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>3 Подраздел первого уровня 1</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>65</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/about/3_podrazdel_pervogo_urovnja_1/</link>
<propertys>
</propertys>
</structure>
<propertys>
</propertys>
</structure>
<structure id="67" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>Контакты</name>
<show>1</show>
<show_link>1</show_link>
<level>0</level>
<id_parent>0</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/kontakty/</link>
<structure id="79" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>4 Подраздел первого уровня 1</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>67</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/kontakty/4_podrazdel_pervogo_urovnja_1/</link>
<propertys>
</propertys>
</structure>
<propertys>
</propertys>
</structure>
<structure id="68" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>Еще раздел</name>
<show>1</show>
<show_link>1</show_link>
<level>0</level>
<id_parent>0</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/eshhe_razdel/</link>
<structure id="80" menu_id="1">
<current_structure_id>7</current_structure_id>
<name>5 Подраздел первого уровня 1</name>
<show>1</show>
<show_link>1</show_link>
<level>1</level>
<id_parent>68</id_parent>
<is_external_link>0</is_external_link>
<external_link></external_link>
<link>/eshhe_razdel/5_podrazdel_pervogo_urovnja_1/</link>
<propertys>
</propertys>
</structure>
<propertys>
</propertys>
</structure>
</document>
Модератор
#
Re: Меню:(
Попробуйте следующий XSL:

<?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="no" method="html" omit-xml-declaration="no" version="1.0"
      media-type="text/xml" />
   <xsl:template match="/document">
      <ul>
         <xsl:apply-templates select="structure[show=1]" />
      </ul>
   </xsl:template>
   <xsl:template match="structure">
      <xsl:param name="posit" select="1" />
      <xsl:variable name="current_structure_id"
         select="/document/structure/current_structure_id" />
      <xsl:if test="show_link = 1">
    <!-- Определяем адрес ссылки -->
         <xsl:variable name="link">
            <xsl:choose>
            <!-- Если внешняя ссылка -->
               <xsl:when test="is_external_link=1">
                  <xsl:value-of disable-output-escaping="yes" select="external_link" />
               </xsl:when>
            <!-- Иначе если внутренняя ссылка -->
               <xsl:otherwise>
                  <xsl:value-of disable-output-escaping="yes" select="link" />
               </xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
        
         <!-- Определяем стиль вывода ссылки -->
         <xsl:variable name="link_style">
            <xsl:choose>
               <!--
                  Выделяем текущую страницу жирным (если это текущая страница, либо
                  у нее есть ребенок с ID, равным текущей)
               -->
               <xsl:when
                  test="current_structure_id=@id or count(.//structure[@id=$current_structure_id])=1">
                  font-weight: bold
               </xsl:when>
            <!-- Иначе обычный вывод с пустым стилем -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         <xsl:choose>
            <xsl:when test="level=0">

            <!-- Идентификатор родительского узла -->
            <xsl:variable name="parent_id" select="current_structure_id" />
            
            <xsl:variable name="class_name"><xsl:choose>
<xsl:when test="$parent_id = 67">Здесь вставляем название css-класса для раздела с идентификатором 67</xsl:when>
<xsl:when test="$parent_id = 65">Здесь вставляем название css-класса для раздела с идентификатором 65</xsl:when>
            <!--
            ...
            -->            <xsl:otherwise></xsl:otherwise>            </xsl:choose></xsl:variable>

            
               <xsl:choose>
                  <xsl:when test="count(structure[show=1]) > 0">
                     <li class="{$class_name}">
                        <xsl:if test="position() = last()">
                           <xsl:attribute name="class">last</xsl:attribute>
                        </xsl:if>
                        <xsl:choose>
                           <xsl:when test="position() = 1">
                              <a href="{$link}" title="Перейти в раздел" id="menu{position()}"
                                 onmouseover="menushow('{position()}');" onmouseout="menuhide('{position()}');">
                                 <span class="part"></span>
                                 <xsl:value-of select="name" />
                              </a>
                              <br />
                              <ul id="smenu{position()}" onmouseover="menushow('{position()}');"
                                 onmouseout="menuhide('{position()}');">
                                 <xsl:variable name="posit_var" select="position()" />
                                 <xsl:apply-templates select="structure[show=1]">
                                    <xsl:with-param name="posit" select="$posit_var" />
                                 </xsl:apply-templates>
                              </ul>
                           </xsl:when>
                           <xsl:when test="position() = last()">
                              <a href="{$link}" title="Перейти в раздел" id="menu{position()}"
                                 onmouseover="menushow('{position()}');" onmouseout="menuhide('{position()}');">
                                 <span class="part"></span>
                                 <xsl:value-of select="name" />
                              </a>
                              <br />
                              <ul id="smenu{position()}" onmouseover="menushow('{position()}');"
                                 onmouseout="menuhide('{position()}');">
                                 <xsl:variable name="posit_var" select="position()" />
                                 <xsl:apply-templates select="structure[show=1]">
                                    <xsl:with-param name="posit" select="$posit_var" />
                                 </xsl:apply-templates>
                              </ul>
                           </xsl:when>
                           <xsl:otherwise>
                              <a href="{$link}" title="Перейти в раздел" id="menu{position()}"
                                 onmouseover="menushow('{position()}');" onmouseout="menuhide('{position()}');">
                                 <xsl:value-of select="name" />
                              </a>
                              <br />
                              <ul id="smenu{position()}" onmouseover="menushow('{position()}');"
                                 onmouseout="menuhide('{position()}');">
                                 <xsl:variable name="posit_var" select="position()" />
                                 <xsl:apply-templates select="structure[show=1]">
                                    <xsl:with-param name="posit" select="$posit_var" />
                                 </xsl:apply-templates>
                              </ul>
                           </xsl:otherwise>
                        </xsl:choose>
                     </li>
                  </xsl:when>
                  <xsl:otherwise>
                     <li>
                        <a href="{$link}" title="Перейти в раздел">
                           <xsl:value-of select="name" />
                        </a>
                     </li>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
               <li>
                  <a href="{$link}">
                     <xsl:value-of select="name" />
                  </a>
               </li>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:if>
   </xsl:template>
</xsl:stylesheet>
Авторизация