Copied to clipboard

Flag this post as spam?

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


  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 21, 2010 @ 09:56
    Sherry Ann Hernandez
    0

    can't access the content property in Xslt top navigation

    Hello,

    I have this xslt code for my top navigation. I use the property showLink because there are links on my top navigation that I don't want to show any landing page.

    Example:

    My problem is I can't get this to work.

     <?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"/>
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />

    <!-- Input the documenttype you want here -->

    <xsl:template match="/">               
        <ul id="nav">                       
            <li><a href="/florahospitality" id="navMain1">Home</a></li>                       
            <xsl:apply-templates select="$siteRoot/*[@isDoc]" />               
        </ul>       
    </xsl:template>

    <!-- The fun starts here -->
    <xsl:template match="*[@isDoc]">               
        <li >                       
           <a href="{umbraco.library:NiceUrl(@id)}" id="navMain2">
       <xsl:if test="$currentPage/showLink = 0">              
                     <xsl:attribute name="href">#</xsl:attribute>                               
               </xsl:if>                                                               
               <xsl:value-of select="@nodeName" />                       
           </a>                                               
           <xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)] and current()[@level = 2]">                               
               <ul>                                       
                  <xsl:apply-templates select="*[@isDoc]" />                               
               </ul>                       
           </xsl:if>               
        </li>       
    </xsl:template>               

    <!-- Never output these  and current()[@level = 2]-->       
    <xsl:template match="*[umbracoNaviHide = 1]" />
    </xsl:stylesheet>

  • Rich Green 2246 posts 4008 karma points
    Oct 21, 2010 @ 10:03
    Rich Green
    0

    I'm not sure what your issue is, but it's convention in Umbraco to use the property 'umbracoNaviHide' when you want to hide something from navigation.

    Change your 'showLink' property to 'umbracoNaviHide', create a new XSLT file and use the 'Navigation Prototype' from the templates, this should be a great starting point for setting up your nav.

    You'll notice that in many XSLT templates / 3rd party XSLT files that 'umbracoNaviHide' is used.

    RIch 

  • Rik Helsen 670 posts 873 karma points
    Oct 21, 2010 @ 10:09
    Rik Helsen
    0

    "cant get this to work" is a bit vague... what output do you get?

  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 21, 2010 @ 10:11
    Sherry Ann Hernandez
    0

    Hi Rich,

    I actually wanted to show the navigation. This is somehow different from umbracoNaviHide.

    What I want to achieve is to replace the value of href.

    For example

    Hotel - If a user hover on this link the href values should be "#" bec I don't want to show any page/content here once they click it. I still want this to be shown that's why I created another property aside from the umbracoNaviHide.

      Hotel 1

      Hotel 2

     

    Meetings and Events - For this 2nd link I want the href values to have the value of the page because once they click it, I will display the content/page.

      Meetings and Conferences -

      Social Events

    Hope I explain it more clearly. :D

    Sherry

  • Rich Green 2246 posts 4008 karma points
    Oct 21, 2010 @ 10:14
    Rich Green
    0

    As Rik says, it would be helpful if you give us more information, what is not working, what is your output and also an image of your content structure would help clarify things.

    Rich

  • Sherry Ann Hernandez 320 posts 344 karma points
    Dec 15, 2010 @ 08:26
    Sherry Ann Hernandez
    0

    issue now solved...

Please Sign in or register to post replies

Write your reply to:

Draft