Copied to clipboard

Flag this post as spam?

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


  • Stefan Arngrimsson 36 posts 59 karma points
    Aug 13, 2010 @ 12:00
    Stefan Arngrimsson
    0

    Navigation is broken after upgrade to 4.5

    Hi,

    I just upgraded to 4.5.1 and my main navigation is broken. I can't find the problem, can anyone help?

    Best regards,

    Stefan

    <?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:param name="startLevel" select="2"/>

      <xsl:template match="/">
        <xsl:if test="count($currentPage/ancestor-or-self::*[@isDoc] [@level = $startLevel]/node) &gt; 0">
          
            <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc] [@level=$startLevel]/node [string(umbracoNaviHide) != '1']">
              <xsl:call-template name="drawnode">
                <xsl:with-param name="level" select="2"/>
              </xsl:call-template>
            </xsl:for-each>
         
        </xsl:if>
      </xsl:template>

      <xsl:template name="drawnode">
        <xsl:param name="level"/>
        <li>
          <xsl:choose>
            <xsl:when test="@id=$currentPage/@id">
      <xsl:if test="$level = 2">
              <xsl:attribute name="class">secondlevelliselected</xsl:attribute>
      </xsl:if>
      <xsl:if test="$level = 3">
              <xsl:attribute name="class">thirdlevelliselected</xsl:attribute>
      </xsl:if>
      <xsl:if test="$level = 4">
              <xsl:attribute name="class">frothlevelliselected</xsl:attribute>
      </xsl:if>
            </xsl:when>
            <xsl:otherwise>
      <xsl:if test="$level = 2">
              <xsl:attribute name="class">secondlevelli</xsl:attribute>
      </xsl:if>
      <xsl:if test="$level = 3">
              <xsl:attribute name="class">thirdlevelli</xsl:attribute>
      </xsl:if>
      <xsl:if test="$level = 4">
              <xsl:attribute name="class">forthlevelli</xsl:attribute>
      </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <href="{umbraco.library:NiceUrl(@id)}">
            <xsl:choose>
              <xsl:when test="@id=$currentPage/@id">
        <xsl:if test="$level = 2">
                    <xsl:attribute name="class">secondLevelSelected</xsl:attribute>
          </xsl:if>
        <xsl:if test="$level = 3">
                    <xsl:attribute name="class">thirdLevelSelected</xsl:attribute>
          </xsl:if>
        <xsl:if test="$level = 4">
                    <xsl:attribute name="class">forthLevelSelected</xsl:attribute>
          </xsl:if>
              </xsl:when>
              <xsl:otherwise>
        <xsl:if test="$level = 2">
                    <xsl:attribute name="class">secondLevel</xsl:attribute>
        </xsl:if>
        <xsl:if test="$level = 3">
                    <xsl:attribute name="class">thirdLevel</xsl:attribute>
        </xsl:if>
        <xsl:if test="$level = 4">
                    <xsl:attribute name="class">forthLevel</xsl:attribute>
        </xsl:if>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="@nodeName"/>
          </a>
    </li>

       
          <xsl:if test="count(descendant-or-self::*[@isDoc]  [@id=$currentPage/@id]) &gt; 0 ">
            
              <xsl:for-each select="*[@isDoc] [string(umbracoNaviHide) != '1']">
                <xsl:call-template name="drawnode">
          <xsl:with-param name="level" select="$level +1"/>
        </xsl:call-template>
              </xsl:for-each>
           
          </xsl:if>
        
      </xsl:template>

    </xsl:stylesheet>
  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Aug 13, 2010 @ 12:09
    Chriztian Steinmeier
    0

    Hi Stefan,

    You've got a couple of "node" references in there that hasn't been updated to *[@isDoc] (in the two lines following match="/")

    /Chriztian

  • Stefan Arngrimsson 36 posts 59 karma points
    Aug 13, 2010 @ 13:00
    Stefan Arngrimsson
    0

    Thanks a lot Chriztian.

     

    worked like a charm :)

  • MartinB 411 posts 512 karma points
    Aug 13, 2010 @ 13:09
    MartinB
    0

    Please mark as solved, thank you :)

Please Sign in or register to post replies

Write your reply to:

Draft