Subject: [xsl] When I have a parent / has a subcat From: "Dan Acuff" <dacuff@xxxxxxxxxxxxxx> Date: Mon, 26 Jul 2010 17:46:06 -0400 |
How do I form the xsl so that I can put a "selected" class for the parent of the child class I have currently selected? <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="UTF-8" method="html" version="4.01" omit-xml-declaration="yes" media-type="text/html"/> <xsl:param name="leftNavId"/> <xsl:template match="menu"> <xsl:choose> <xsl:when test="$leftNavId = 'nothing'"> <!--do nothing--> </xsl:when> </xsl:choose> <ul class="adxm menu"> <xsl:apply-templates select="category"/> </ul> </xsl:template> <xsl:template match="category"> <xsl:choose> <xsl:when test="$leftNavId = 'nothing'"> <!--do nothing--> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$leftNavId=@name"> <xsl:if test="(child::category)"> <xsl:for-each select="child::category"> <xsl:choose> <xsl:when test="count(descendant::category) > 1"> <li id="{@name}" class="leftnav_parent"> <xsl:call-template name="leftNavParentCheck"/> </li> </xsl:when> <xsl:otherwise> <li class="leftnav_noflyout"> <xsl:call-template name="leftNavParentCheck"/> </li> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:if> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="leftNavParentCheck"> <a href="{info//link}" title="{@display_name} "> <xsl:value-of select="@display_name"/> </a> <ul> <xsl:for-each select="descendant::category"> <xsl:choose> <xsl:when test="count(descendant::category) > 1"> <li class=""> <a href="{info//link}" title="{@display_name} "> <xsl:value-of select="@display_name"/> </a> </li> </xsl:when> <xsl:otherwise> <li> <a href="{info//link}" title="{@display_name} "> <xsl:value-of select="@display_name"/> </a> </li> </xsl:otherwise> </xsl:choose> </xsl:for-each> </ul> </xsl:template> </xsl:stylesheet> ~~~~~~~~~~~~~~~~~~ Dan Acuff Developer SureSource LLC 20 Constitution Blvd. South Shelton, CT 06484 203.922.7546 direct ~~~~~~~~~~~~~~~~~~
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] <xsl:for-each> , only loo, Evgeny Gazdovsky | Thread | Re: [xsl] When I have a parent / ha, Michael Kay |
Re: [xsl] <xsl:for-each> , only lo, David Carlisle | Date | Re: [xsl] When I have a parent / ha, Michael Kay |
Month |