Copied to clipboard

Flag this post as spam?

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


  • Owen Hope 119 posts 140 karma points
    Nov 22, 2010 @ 20:00
    Owen Hope
    0

    Sub Navigation Problem

    Hello,

    Using Umbraco 4.5.2 and having some difficulties writing a XSLT for my Sub Navigation. 

    Here is my tree:

    Now I am a little unclear on levels, but my understanding is:

    Home - Level 1

    News and Media - Level 2

    Video - Level 3

    Campbell River Video - Level 4

     

    Now output is like this:

     

    So far I am able to output the Level 2 Nav ($currentPage name and id)

    But from there I am stumped. Here is my current XSLT:

    <?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:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
      <!-- Sub Nav Heading -->
      <h1>
        <a href="{umbraco.library:NiceUrl($currentPage/@id)}"><xsl:value-of select="$currentPage/@nodeName"/></a>
      </h1>
      
    <ul>
      <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=2]/node [string(data [@alias='umbracoNaviHide']) != '1']">
        <xsl:if test="number($currentPage/@level)=3">
          <xsl:for-each select="$currentPage/child::node [@level=3]/node [string(data [@alias='umbracoNaviHide']) != '1']">
            <li>
              <a href="{umbraco.library:NiceURL($currentPage/@id)}"><xsl:value-of select="$currentPage/@nodeName"/></a>
            </li>
          </xsl:for-each>
        </xsl:if>
      </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

     

    Any help or suggestions would be great! Still fairly new to XSLT.

    Thanks,

     

    Owen

Please Sign in or register to post replies

Write your reply to:

Draft