Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 662 karma points
    Nov 30, 2011 @ 13:06
    Martin
    0

    External Link in Navi

    Hi,Im trying to put an external link within my top level navigation.

    Ive seen this tutorial where it creates a doctype and a reference it within the navi xslt.

    http://www.robertbird.co.uk/blog/2010/09/29/umbraco-adding-external-links-to-the-main-navigation-menu/

    I cant seem to get it to work.

    When I insert the code i get a

    System.OverflowException: Value was either too large or too small for an Int32. 

    Any help would be grateful.

     

     

    my Navi xslt.

      <xsl:template match="/">  
        <!-- Root Node -->
        <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root" />
        <!-- Homepage -->
        <xsl:variable name="homeNode" select="$rootNode/Home [@isDoc]" />    
        <ul class="sf-menu">
          <li>
            <!--
            Add the CSS class 'selected' if the homeNode ID matches our
            currentPage node ID
            -->
            <xsl:if test="$homeNode/@id = $currentPage/@id">
              <xsl:attribute name="class">
                <xsl:text>selected</xsl:text>
              </xsl:attribute>
            </xsl:if>       
            <!--Create a link to the homepage -->
            <href="{umbraco.library:NiceUrl($homeNode/@id)}">
              <xsl:value-of select="$homeNode/@nodeName" />
            </a>
          </li
          
          <!--
          For each child node of the homeNode that is a document (isDoc)
          and the level is 2
          and the property umbracoNaviHide is NOT 1 (true/checked)
          -->
          
          
          
    <xsl:for-each select="$homeNode/*[@level = 2][umbracoNaviHide != 1]">
      <li class="{@urlName}">
              
        <xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
          <xsl:attribute name="class"><xsl:value-of select="concat(@urlName, ' selected')"/></xsl:attribute>
        </xsl:if>
         <xsl:if test="position() = last()">
            <xsl:attribute name="id">
              <xsl:text>last</xsl:text>
            </xsl:attribute>
          </xsl:if>
        <xsl:if test="umbraco.library:HasAccess(@id,@path)">
        <!-- Create the link -->
        <href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName" /></a>
        </xsl:if>  
      </li>
            
    </xsl:for-each>
          
        </ul>
      </xsl:template>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 30, 2011 @ 18:35
    Jan Skovgaard
    0

    Hi Martin

    Try saving the above xslt outside of Umbraco or simply just mark the "skip error check" before you save the XSLT file within Umbraco. It has to do with Umbraco not getting the value before runtime...

    It's always a good idea to use an editor to edit XSLT files outside of Umbraco.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft