Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Nov 29, 2012 @ 13:41
    Kate
    0

    Submenu problem - more than 1 level

    Hi

    I have a submenu that works fine with 2 levels but I'm not sure it's the right way to do it. Here is my code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="level" select="2"/>
    <xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::*
    [@isDoc and @level &lt;= 3 and (
    (self::AlmindeligTekstSide) or (self::TextPage))]" />

    <div>
    <ul class="level1">
    <xsl:for-each select="$rootTextpageNode/* [@isDoc and string(umbracoNaviHide) != '1']">
    <li>
    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
    <xsl:attribute name="class">
    <xsl:text>select</xsl:text>
    </xsl:attribute>
    </xsl:if>
    <a href="{umbraco.library:NiceUrl(current()/@id)}">

    <xsl:if test="@level &gt; 3">
    <xsl:attribute name="class">
    <xsl:text>level2</xsl:text>
    </xsl:attribute>
    </xsl:if>
    <xsl:value-of select="current()/@nodeName"/>

    </a>
    </li>
    </xsl:for-each>
    </ul>
    </div>
    </xsl:template>
    </xsl:stylesheet>

    I would be grateful if you would look through the code and give feedback. thanks

    I have an ekstra question to the menu.
    If there is no submenu I would like there to be inserted an image instead of the <ul>. How do I do that?

     

  • 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