Copied to clipboard

Flag this post as spam?

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


  • Emmanuel 7 posts 27 karma points
    Sep 14, 2012 @ 07:32
    Emmanuel
    0

    Top Navigation doesnot show.

    I added an xslt for navigation in my site, I used a template within Umbraco called Navigation Prototype. But it doesnot show the links when I browse my site.

    When I view source code for my site, In the div where the Navigation should be I see this HTML below. I dont think the xslt creates the navigation.What could be the cause of this. Help me out. Thank you.

    <div class ="path">  
      <ul />
      </div>
  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 14, 2012 @ 07:40
    Fuji Kusaka
    0

    Hi Emmanuel,

    Assuming you have a structure starting at Level 1, try doing something like in your xslt. If not please post your code.

    <xsl:variable name="level" select="1"/>
    <xsl:variable name ="nodes" select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc][not(umbracoNaviHide =1)]" >
    <xsl:template match="/">
    <div class="path">
    <xsl:for-each select="$nodes">
    <a href="<xsl:value-of select="umbraco.library:NiceUrl(@id)"/><xsl:value-of select="@nodeName"/></a>
    </xsl:for-each> 
    </div>

    //fuji

  • Emmanuel 7 posts 27 karma points
    Sep 14, 2012 @ 08:06
    Emmanuel
    0

    This the code for my xslt file

    <?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"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
    <!-- Use div elements around this macro combined with css -->
    <!-- for styling the navigation -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
            <!-- we're under the item - you can do your own styling here -->
            <xsl:attribute name="class">selected</xsl:attribute>
          </xsl:if>
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

    This is the code for  my navigation in the stylesheet.

    .path {
      background: #949490;
      color: #FFF;
      font: normal 1.1em Verdana,sans-serif;
      padding: 8px 12px;
    }

    This is the code for Navigation in my template.(They were hard coded but I removed and put a macro.)

    <div class ="path">  
    <umbraco:Macro Alias="MainNavigation" runat="server"></umbraco:Macro></div>

    I modified my code in my xslt file according to yours but it didnt work properly..


  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 14, 2012 @ 08:18
    Fuji Kusaka
    0

    Sorry this line should be 

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">

    instead of 

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
    

     

  • Emmanuel 7 posts 27 karma points
    Sep 14, 2012 @ 10:31
    Emmanuel
    0

    Thanks I was able to do it.

  • 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