[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

When I have a parent / has a subcat

Subject: When I have a parent / has a subcat
From: "Dan Acuff" <dacuff@xxxxxxxxxxxxxx>
Date: Mon, 26 Jul 2010 17:46:06 -0400
 When I have a parent / has a subcat
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.