Copied to clipboard

Flag this post as spam?

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


  • Adrian Inman 35 posts 59 karma points
    Mar 15, 2011 @ 18:55
    Adrian Inman
    0

    Grouped Navigation

    I'm not sure if I should try this in razor instead, but I think it should definitely be possible in XSLT.

    My site has a dynamic navigation, but this needs to be grouped for display purpses. I have added a numberic property to the document type called navGroup which allows me to group pages into navigation groups - same number = same group

    I basically want to produce 4x ul li lists one after the other - one for each navigation group.

    The site was originally implemented in raw .Net and parsed an XML file with the navigation structure in, so this wasn't an issue.

    I am now porting the site to umbraco and need to re-create this effect. I have used the CogWorks nav Macro/XSLT package so far and have it doing enough to play with initially.

    I don't need to do anything fancy such as highlight the current page - just output a link and a string from the associated page.

    Please help!

  • Adrian Inman 35 posts 59 karma points
    Mar 15, 2011 @ 19:16
    Adrian Inman
    0

    Having inspected more closely, I don't think this is strictly necessary now. (Sorry). I think I can customise the output of the Cog Works XSLT to give the format of ul and li's I need to get the desired result.

     

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 15, 2011 @ 23:10
    Chriztian Steinmeier
    0

     

    Hi Adrian,

    If you've only got 4 groups, I'd definitely go for the simple approach - along the lines of:

    <xsl:param name="currentPage"  />
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
    <xsl:template match="/">
        <ul>
            <xsl:apply-templates select="$siteRoot/*[@isDoc][navGroup = 1]" />
        </ul>
        <ul>
            <xsl:apply-templates select="$siteRoot/*[@isDoc][navGroup = 3]" />
        </ul>
        <ul>
            <xsl:apply-templates select="$siteRoot/*[@isDoc][navGroup = 4]" />
        </ul>
    </xsl:template>
    
    <xsl:template match="*[@isDoc]">
        <li><xsl:value-of select="@nodeName" /></li>
    </xsl:template>
    

    /Chriztian

     

Please Sign in or register to post replies

Write your reply to:

Draft