<?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">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-top: 2px; margin-left: 0px;">
<tr>
<xsl:apply-templates select="structure[show=1]"/>
</tr>
</table>
</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:choose>
<xsl:when test="count(structure[show=1]) > 0">
<td valign="top" OnMouseOver="JavaScript:SlideLayer('id_{@id}'

;" OnMouseOut="JavaScript:SlideLayerHide('id_{@id}'

;">
<div>
<a href="{$link}" class="menu_center"><xsl:value-of select="name"/></a>
</div>
<div style="display: none; z-index: 10; padding-right: 0; margin-top: 1px; margin-left: 0px; margin-right: 0px;" id="id_{@id}">
<table border="0" cellpadding="0" cellspacing="0">
<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>
</table>
</div>
</td>
</xsl:when>
<xsl:otherwise>
<td valign="top" align="center">
<a href="{$link}" class="menu_center"><xsl:value-of select="name"/></a>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<tr>
<td><a href="{$link}" class="menu_link_no_bold"><xsl:value-of select="name"/></a>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>