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 20, 2010 @ 17:09
    Sherry Ann Hernandez
    0

    How do I get the property alias in xslt

    Hi,

    I have a property show link. I will use this because some of the link it should not show any page when a user clicks the 2nd level navigation instead selects on the dropdown menu. But for other links when the user select the link it will show a page.

    The show link has a true/false value.

     

    Here's my xslt

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

    But it still show the link even if I set it to false in the content page.     

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Oct 20, 2010 @ 21:56
    Lee Kelleher
    0

    Hi Sherry,

    Hmmm... have you tried comparing with the value in quotes?

    <xsl:if test="*[@isDoc][not(umbracoNaviHide = '1')] and $currentPage/showLink = '0'">

    and

    <xsl:if test="*[@isDoc][not(umbracoNaviHide = '1')]">

    I think the value it treated as a "string", rather than a numeric.

    Cheers, Lee.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 20, 2010 @ 23:19
    Morten Bock
    2

    How about:

    <xsl:if test="not(./umbracoNaviHide = 1) and $currentPage/showLink = 0">                                                       

    and

    <xsl:if test="not(./umbracoNaviHide = 1)"> 

     

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 9x admin c-trib
    Oct 21, 2010 @ 00:56
    Chriztian Steinmeier
    0

    Hi Sherry,

    Your code should work just fine - (all the versions here will yield the same result) - but I'm curious if the conditions match your logic?

    The '#' will only replace the href if there's at least one subpage that isn't hidden AND the showLink property isn't set - did you mean OR instead, or am I missing the purpose of the property?

    Other than that, there could be a problem if you added the showLink property later, and pages created before that hasn't got their value for it. That's why I'm always using the not(something) syntax instead (which you do for umbracoNaviHide already), so you could try:

    <xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)] and not($currentPage/showLink = 1)"> 

    /Chriztian

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

    Hi Chriztian,

    Yes you are right it should have been "OR" instead "AND". :D my bad.

    I wasn't looking at my logic but instead I was focusing if I reference the property right.

    Thanks guys.

    I love umbraco and the very helpful community. It's been only a week since I used umbraco but I'm learning a lot.

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

    Sorry guys,

    I tagged this as solved but somehow I still can't display my link properly.

    I used the showLink properly in my top navigation because there are links that I don't want to show any page.

    example for the hotel links the user should select from the list of hotel and when he clicks the hotel link it won't show anything.

    but for the meetings and events, aside from the dropdown list, if the user clicks the meetings and events I will display the home page

    for the meetings and events. :D

  • 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