Вывожу подменю в зависимости от раздела
<?
// Подменю
$Structure = new Structure();
$structure_parent_id = CURRENT_STRUCTURE_ID;
while ($structure_parent_id != 0)
{
$row_structure = $Structure->GetStructureItem($structure_parent_id);
$structure_parent_id = $row_structure['structure_parent_id'];
}
$Structure->ShowStructure(false, 'МенюРаздел', array('parent_id' => $row_structure['structure_id']));
?>
<?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="/document">
<ul class="razdel">
<!-- Выбираем узлы структуры -->
<xsl:apply-templates select="structure[show=1]"/>
</ul>
</xsl:template>
<xsl:template match="structure">
<!-- Запишем в константу ID структуры, данные для которой будут выводиться пользователю -->
<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:choose>
<xsl:when test="current_structure_id=@id or count(.//structure[@id=$current_structure_id])=1">
<li class="active">
<div class="cornerLeft"></div>
<div class="cornerRight"></div>
<a href="{$link}" title="{name}" class="active">
<xsl:value-of disable-output-escaping="yes" select="name"/></a>
</li>
</xsl:when>
<!-- Иначе обычный вывод с пустым стилем -->
<xsl:otherwise><li><a href="{$link}" title="{name}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a></li></xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- Если не показывать ссылку - выводим просто имя ссылки -->
<xsl:if test="show_link=0">
<li>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Если нет подменю то выводится пустой
<ul class="razdel"></ul> , как сделать чтобы ul не выводился в моем решении?