Copied to clipboard

Flag this post as spam?

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


  • Akruti 30 posts 50 karma points
    Jan 11, 2010 @ 13:42
    Akruti
    0

    Remove Link-XSLT Help

    Hey I have created a drop down menu with the help of xslt and have used spry menu bar horizontal for that. But in that i dont want the parent node i.e. the first node to be clickable.I want to remove the link from that. So please can you tell me how can we achieve this.  

     

     

    Thanks

    Akruti.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 11, 2010 @ 14:01
    Dirk De Grave
    0

    it would be great if you'd show us your site structure and current xslt snippet.

    looking forward to your info.

     

    Cheers,

    /Dirk

  • Akruti 30 posts 50 karma points
    Jan 11, 2010 @ 15:44
    Akruti
    0

    Hey this is the link to my website. http://66.132.221.236:82/1047.aspx?umbVersion=f864a1cf-621e-4c0b-90c3-628fd418b37f

    Here i dont want the Services link to be clickable. About us and events can be clicked.

    My xslt code is pasted here:

     

    <?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"/>

      <!-- update this variable on how deep your site map should be -->
      <xsl:variable name="maxLevelForSitemap" select="4"/>
     <xsl:template match="/">
       <div id="mainnav">
          <xsl:call-template name="drawNodes">
           <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/>
           </xsl:call-template>
        </div>
      </xsl:template>
      <xsl:template name="drawNodes">
    <xsl:param name="parent"/>
          <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
          <ul id="MenuBar1" class="MenuBarHorizontal">
            <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]">
            <li>
                <a class="MenuBarItemSubMenu" href="{umbraco.library:NiceUrl(@id)}">
                  <xsl:value-of select="@nodeName"/>
                </a>
                <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">
                  <xsl:call-template name="drawNodes">
                    <xsl:with-param name="parent" select="."/>
                  </xsl:call-template>
      </xsl:if>
              </li>
            </xsl:for-each>
          </ul>
        </xsl:if>
        </xsl:template>
      </xsl:stylesheet>

     

    Please revert as soon as possible. Thank you.

     

  • Akruti 30 posts 50 karma points
    Jan 12, 2010 @ 04:33
    Akruti
    0

    Hey please help to solve this issue.

  • vijay 129 posts 152 karma points
    Jan 12, 2010 @ 07:18
    vijay
    0

    hi Akruti,

    I think u r directly applying link in my opinion first u have to check the node name then apply url to anchor tag.if it is services apply # to anchor tag.

    if u want i can give idea using using user control.

    hope this helps,

    ---vijay.

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jan 12, 2010 @ 14:48
    Jesper Hauge
    0

    Your site appears to be down - so i can't check what the output should be, but one way of solving this could be to do something like this:

    <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]">
        <li>
            <xsl:choose>
                <xsl:when test="./@nodeName = 'Services'">
                    <a class="MenuBarItemSubMenu" href="#">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </xsl:when>
                <xsl:otherwise>
                    <a class="MenuBarItemSubMenu" href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">
                <xsl:call-template name="drawNodes">
                    <xsl:with-param name="parent" select="."/>
                </xsl:call-template>
            </xsl:if>
        </li>
    </xsl:for-each>

    This is assuming the node-name of the Services page is "Services". This will render any node with nodeName = "Services" as a "dead" link, if you want the link to be completely absent, just remove the "a"-tag

    Regards
    Jesper Hauge

Please Sign in or register to post replies

Write your reply to:

Draft