В XSL не силен. Прошу помочь знающих людей в решении следующей задачи. Необходимо вывести в формате:
<span class="first"><a href="#">Уровень 1</a></span>
<span class="second"><a href="#">Уровень 2</a></span>
<span class="second"><a href="#">Уровень 2</a></span>
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
<span class="first"><a href="#">Уровень 1</a></span>
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
<span class="first"><a href="#">Уровень 1</a></span>
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
<span class="first"><a href="#">Уровень 1</a></span>
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
<span class="first"><a href="#">Уровень 1</a></span>
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
<span class="first"><a href="#">Уровень 1</a></span>
И чтобы после каждого первого уровня, кроме последнего, выводился разделитель:
<span><img src="images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
Сам 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:template match="/">
<xsl:apply-templates select="/shop"/>
</xsl:template>
<!-- Шаблон для магазина -->
<xsl:template match="/shop">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
function show_hide_menu(id)
{
if (obj = document.getElementById(id))
{
obj.style.display == 'none' ? obj.style.display = 'block' : obj.style.display = 'none';
return false;
}
return true;
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<xsl:apply-templates select="group"/>
</xsl:template>
<!-- Шаблон для групп товара -->
<xsl:template match="group">
<span class="first">
<a href="{/shop/path}{fullpath}" onClick="return show_hide_menu('{@id}');">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</span>
<!-- Если есть подгруппы -->
<xsl:if test="group">
<span class="second" id="{@id}" style="display: none;">
<xsl:apply-templates select="group"/>
</span>
</xsl:if>
<span><img src="/images/catalog_menu_line.gif" alt="" width="43" height="2" /></span>
</xsl:template>
</xsl:stylesheet>