Copied to clipboard

Flag this post as spam?

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


  • Matthew Jarvis 129 posts 129 karma points
    Oct 13, 2011 @ 19:37
    Matthew Jarvis
    0

    Menu navigation help

    I currently have the following menu on my website (where my mouse is currently hovering over Testuser)

    This is my XSLT for the above

     

     <xsl:template match="*">

    <xsl:if test="umbraco.library:HasAccess(@id, @path) = true()">
          <li>
            <a title="{nodeName}">
              <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
              xsl:attribute>
              <xsl:attribute name="class">level<xsl:value-of select="@level" />
                <xsl:if test="position() = 1"><xsl:text> firstxsl:text>xsl:if>
                <xsl:if test="position() = last()"><xsl:text> xsl:text>lastxsl:if>
                <xsl:if test="$currentPage/ancestor::*/@id = current()/@id"><xsl:text> xsl:text>expandedxsl:if>
                <xsl:if test="@id = $currentPage/@id"><xsl:text> xsl:text>currentxsl:if>
                <xsl:if test="count(./*[string(umbracoNaviHide) != '1']) > 0"><xsl:text> xsl:text>parentxsl:if>
                xsl:attribute>
             
                 -<xsl:value-of select="umbraco.library:Item(@id, 'pageName')"/> <xsl:if test="count(./*[@isDoc]) > 0"> xsl:if>
               
            a>
            <xsl:if test="count(./*[string(umbracoNaviHide) != '1']) > 0">
              <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                <ul>
                  <xsl:apply-templates select="./*[@isDoc and string(umbracoNaviHide) != '1']" />
                ul>
              xsl:if>
            xsl:if>
      li>
      xsl:if>
      xsl:template>

             
       The web designer however I had to design templates for me, designed the below which I hope to implement

    Which was made possible through the following HTML

    <ul>
    <li><a href="#">Homea>li>
    <li><a href="#">The Collegea>li>
    <li class="current"><a href="#">Coursesa>
    <ul>
                <li class="current"><a href="#">- Work based learninga>li>
                <li ><a href="#">- Course Xa>li>
                <li ><a href="#">- Course Ya>li>
    ul>
    li>
    <li><a href="#">Community Learninga>li>
    <li><a href="#">Student Lifea>li>
    <li><a href="#">News & Eventsa>li>
    <li><a href="#">Centre Traininga>li>
    ul>  

     

    What I'm really struggling to implement is where I should put the element

    <li class="current">

    in my XSLT.  The example from my designer shows what the menu would look like when the current page is viewed with any sub nodes

    Any guidance would be much appreciated

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft