Copied to clipboard

Flag this post as spam?

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


  • Carl 15 posts 36 karma points
    Aug 12, 2011 @ 20:01
    Carl
    0

    Menu/Nav macro in templates not showing all nodes on site

    Hey everyone,

    I'm running into a small issue that I know is with my template and not the XSLT, but will post both.

    I have a very simple horizonal navigation macro on the "master" template no errors but only shows the node its presently on. For example if I'm on the contact page only contactpage will show on the menu. If I'm on About Us page only About Us will show in the menu. I know its something small I'm missing, but its drving me nuts

    I have created the following templates based on a hieracy

    Master

    - HomePage

    -StdPage

     

    I have used the same xslt before and it worked fine, which leads me to belive its the way my templates are structured.

     

    My master.master with html removed

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
     
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
     
      <umbraco:Macro Alias="MainNav" runat="server"></umbraco:Macro>
         
         
    <asp:ContentPlaceHolder Id="MainContentArea" runat="server">
     
     
     
    </asp:ContentPlaceHolder>
         


      
       
    </asp:Content>

     

    My homepage.master with html removed

    <%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
     
    html content here
     
    </asp:Content>

     

      My XSLT -MainNav

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:uTube.XSLT="urn:uTube.XSLT" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml
     umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
    Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
    Exslt.ExsltSets uTube.XSLT ucomponents.dates ucomponents.search
    PS.XSLTsearch ">

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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
      <xsl:variable name="level" select="1" />
     <ul id="dropdown-menu" class="fixed">
     
      <li>
    <xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
           <xsl:attribute name="class">current</xsl:attribute>
    </xsl:if>

          <a href="/">     
             <xsl:value-of select="$currentPage/ancestor-or-self::*/@nodeName"/>
          </a>  
     </li>
      
      <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">  
      <li>
         <xsl:attribute name="class">
             <xsl:if test="$currentPage/@id=@id">
              <xsl:text>current</xsl:text>
              </xsl:if>
         </xsl:attribute>
        
        
        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>    
      
      
        <!-- Drop Down Menu -->
        <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
           <ul>
             <xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
                 <li>
                   
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
           <xsl:attribute name="class">current</xsl:attribute>
    </xsl:if>

                   
                   <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
             </xsl:for-each>
           </ul>
        </xsl:if>
        <!-- End of Drop Down Menu -->
        
      </li>
      </xsl:for-each>
      
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    Thanks in advance for everyones help

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2011 @ 21:10
    Dirk De Grave
    0

    Carl,

    It helps if you could outline some nodes from your content structure (pic?), and output you get from a specific page when the xslt

     

    Looking forward to your info.

     

    Cheers,

    /Dirk

  • Carl 15 posts 36 karma points
    Sep 02, 2011 @ 16:11
    Carl
    0

    Hey Dirk,

    Sorry about the late reply. I figured it out. I wasnt putting it in the template correctly. Just needed sleep.

     

    Thanks for your help

Please Sign in or register to post replies

Write your reply to:

Draft