Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andrew Stoddart 2 posts 22 karma points
    May 20, 2012 @ 20:07
    Andrew Stoddart
    0

    breadcrumb

    I have a breadcrumb where I need it to be styled differently if the breadcrumb trail is on two nodes than if there is 3,4,5 etc...is this possible? If so could someone please help?

    Thanks

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 20, 2012 @ 20:19
    Chriztian Steinmeier
    0

    Hi Andrew,

    You can do something like this (setting a class on the <ul> if there is less than 3 nodes in the breadcrumb):

       <xsl:template match="/">
            <xsl:variable name="trail" select="$currentPage/ancestor-or-self::*[@isDoc]" />
            <ul>
                <xsl:if test="count($trail) &lt; 3"> <xsl:attribute name="class">special</xsl:attribute> </xsl:if>
                <xsl:apply-templates select="$trail" />
            </ul>
        </xsl:template>
    
    <!-- Template for individual nodes in the nav -->
        <xsl:template match="*[@isDoc]">
            <li>
                <a href="{umbraco.library:NiceUrl(@id)}">
                    <xsl:value-of select="@nodeName" />
                </a>
            </li>
        </xsl:template>
    

    /Chriztian

  • Andrew Stoddart 2 posts 22 karma points
    May 20, 2012 @ 20:37
    Andrew Stoddart
    0

    Thanks Chriztian i'll give it a go

Please Sign in or register to post replies

Write your reply to:

Draft