I have the following xml package which works fine to display the parent and sub categories at level 1. But within the subcategories i have another level.
How do i display all of these levels? and then products so that i can style them in a menu?
Code:
<package version="2.1" displayname="Categories" debug="false" includeentityhelper="true">
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="CategoryID">
<xsl:choose>
<xsl:when test="/root/System/PageName = 'showmanufacturer.aspx' or /root/System/PageName = 'showsection.aspx' or /root/System/PageName = 'showdistributor.aspx' or /root/System/PageName = 'showvector.aspx' or /root/System/PageName = 'showgenre.aspx'">0</xsl:when>
<xsl:when test="/root/System/PageName = 'showcategory.aspx' and boolean(/root/QueryString/categoryid)">
<xsl:value-of select="/root/QueryString/categoryid"/>
</xsl:when>
<xsl:when test="(/root/System/PageName = 'showcategory.aspx' or /root/System/PageName = 'showproduct.aspx') and boolean(/root/Cookies/lastviewedentityinstanceid) and /root/Cookies/lastviewedentityname = 'Category'">
<xsl:value-of select="/root/Cookies/lastviewedentityinstanceid"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="AncestorID">
<xsl:for-each select="/root/EntityHelpers/Category//Entity[EntityID = $CategoryID]">
<xsl:value-of select="ancestor::*/EntityID"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="ParentID">
<xsl:for-each select="/root/EntityHelpers/Category//Entity[EntityID = $CategoryID]">
<xsl:value-of select="parent::*/EntityID"/>
</xsl:for-each>
</xsl:param>
<xsl:template match="/">
<xsl:element name="ul">
<xsl:attribute name="class">
<![CDATA[tame]]>
</xsl:attribute>
<xsl:apply-templates select="/root/EntityHelpers/Category/Entity">
<xsl:with-param name="prefix" select="''"/>
<xsl:with-param name="classToUse" select="'tame'"/>
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="Entity">
<xsl:param name="classToUse"></xsl:param>
<xsl:param name="prefix"></xsl:param>
<xsl:param name="eName" select="aspdnsf:GetMLValue(Name)" />
<li class="{$classToUse}">
<xsl:value-of select="$prefix" />
<xsl:if test="number(ParentEntityID) != 0">
<span class="catMark">>></span> 
</xsl:if>
<a href="{concat('c-',EntityID,'-',SEName,'.aspx')}">
<xsl:if test="EntityID = $CategoryID or descendant::Entity/EntityID = $CategoryID">
<xsl:attribute name="style">font-weight:bold</xsl:attribute>
</xsl:if>
<xsl:value-of select="$eName"/>
</a>
<xsl:if test="count(child::Entity)>0">
<ul class="tamesub">
<xsl:apply-templates select="Entity">
<xsl:with-param name="classToUse" select="'tametwo'"/>
<xsl:with-param name="prefix" select="concat($prefix, '  ')"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="/">
<xsl:element name="ul">
<xsl:attribute name="id">
<![CDATA[accordion]]>
</xsl:attribute>
<xsl:apply-templates select="/root/EntityHelpers/Category/Entity">
<xsl:with-param name="prefix" select="''"/>
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="Entity">
<xsl:param name="prefix"></xsl:param>
<xsl:param name="eName" select="aspdnsf:GetMLValue(Name)" />
<li >
<!--<xsl:value-of select="$prefix" />-->
<xsl:if test="number(ParentEntityID) != 0">
<!--<span class="catMark">>></span> -->
<a href="{concat('c-',EntityID,'-',SEName,'.aspx')}">
<xsl:if test="EntityID = $CategoryID or descendant::Entity/EntityID = $CategoryID">
<xsl:attribute name="style">font-weight:bold</xsl:attribute>
</xsl:if>
<xsl:value-of select="$eName"/>
</a>
</xsl:if>
<xsl:if test="number(ParentEntityID) = 0">
<div>
<xsl:value-of select="$eName"/>
</div>
</xsl:if>
<xsl:if test="count(child::Entity)>0">
<ul >
<xsl:apply-templates select="Entity">
<xsl:with-param name="prefix" select="concat($prefix, '  ')"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package>