Copied to clipboard

Flag this post as spam?

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


  • NightWolf 41 posts 44 karma points
    Sep 26, 2009 @ 06:33
    NightWolf
    0

    Fancy menu format

    I have the following structure:

    • Parent 1
      • Child 1
      • Child 2
    • Parent 2

    I am sure you can picture the rest :) I would like to create the following structure using xslt:

    UL
        LI
        LI

    UL

    Below is the code implemented:

    <xsl:for-each select="$currentPage/ancestor-or-self::node [string(data [@alias='umbracoNaviHide']) != '1']">
            <xsl:call-template name="drawNodes"> 
                <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/> 
            </xsl:call-template>
        </xsl:for-each>

     

    <xsl:template name="drawNodes">
        <xsl:param name="parent"/>

        <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
            <ul>
            <xsl:choose>
                  <xsl:when test="@level &gt; 1">
                <xsl:attribute name="style">display: none; visibility: hidden;</xsl:attribute>
                    </xsl:when>
                    <xsl:otherwise>
                  <xsl:attribute name="class">sf-menu menuitem sf-js-enabled</xsl:attribute>
                    </xsl:otherwise>
                </xsl:choose>
                <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]">
                    <xsl:sort select="@sortOrder" data-type="number" order="ascending" />
                   
                    <li>
                        <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="@nodeName"/></a>
                        <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">  
                            <xsl:call-template name="drawNodes">
                                <xsl:with-param name="parent" select="."/></xsl:call-template>
                    </xsl:if>
                    </li>
                </xsl:for-each>
            </ul>
        </xsl:if>
    </xsl:template>

     

    Any help would be appreciated, thanks.

  • Folkert 82 posts 212 karma points
    Sep 26, 2009 @ 07:50
    Folkert
    0

    Do you want to implement Superfish dropdown? Using jquery, you don't need to add those classes because they are set client-side. You can just assign the id of the menu to add superfish.

  • NightWolf 41 posts 44 karma points
    Sep 26, 2009 @ 08:07
    NightWolf
    0

    Thanks for that, the class names aren't the issue it's the seperate UL for each parent node causing the problem. I have some advanced styling which requires it be implemented this way.

  • Masood Afzal 176 posts 522 karma points
    Sep 26, 2009 @ 18:25
  • 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