Copied to clipboard

Flag this post as spam?

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


  • Filip Lundby 128 posts 149 karma points
    Jan 14, 2010 @ 11:15
    Filip Lundby
    0

    Making a plain navigation structure?

    I would like to change my navgation from this...

    <ul>
    <li class="seleted">Top1
    <ul>
    <li>Sub1</li>
    <li class="seleted">Sub2
    <ul>
    <li class="seleted">SubSub1</li>
    <li>SubSub1</li>
    <li>SubSub1</li>
    </ul>
    </li>
    <li>Sub3</li>
    </ul>
    </li>
    <li>Top2</li>
    <li>Top3</li>
    </ul>

    To this ...

    <ul>
    <li class="seleted">Top1</li>
    <li>Top2</li>
    <li>Top3</li>
    </ul>
    <ul>
    <li>Sub1</li>
    <li class="seleted">Sub2</li>
    <li>Sub3</li>
    </ul>
    <ul>
    <li class="seleted">SubSub1</li>
    <li>SubSub2</li>
    <li>SubSub3</li>
    </ul>

    Should be easy, right? But my brain wont work toaday :-S

  • Filip Lundby 128 posts 149 karma points
    Jan 14, 2010 @ 12:13
    Filip Lundby
    0

    After a brain-reboot it's running agian :-) Will post solution ...

  • Filip Lundby 128 posts 149 karma points
    Jan 14, 2010 @ 12:21
    Filip Lundby
    1

    This is a simplified version of my xslt ...

    <xsl:template match="/">

    <xsl:call-template name="menu">
    <xsl:with-param name="level" select="1"/>
    </xsl:call-template>

    </xsl:template>


    <xsl:template name="menu">
    <xsl:param name="level"/>
    <xsl:variable name="navNodes" select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']" />

    <ul>
    <xsl:for-each select="$navNodes">
    <li><xsl:value-of select="@nodeName"/></li>
    </xsl:for-each>
    </ul>


    <xsl:for-each select="$navNodes">

    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
    <xsl:call-template name="menu">
    <xsl:with-param name="level" select="$level+1"/>
    </xsl:call-template>
    </xsl:if>

    </xsl:for-each>

    </xsl:template>
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies