Copied to clipboard

Flag this post as spam?

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


  • Partha Ghosh 9 posts 64 karma points
    Dec 09, 2014 @ 13:35
    Partha Ghosh
    0

    Displaying MenuItem in Left Navigation

    Hello,

    Pls. have a look at the attached screenshot. The name of my contenet is "Used Air-Cooled Chillers". It is visible in the left navigation menu. But in the left navigation menu, I want  "Air-Cooled Chillers" (without used)  to be displayed instead of  "Used Air-Cooled Chillers". I want the Menu Item field of the properties to be displayed instead of Name field (see properties Tab).

     

    Here is my leftnavigation.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:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">

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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) != '1' and string(chkShowInNavigation) = '1']">
      <div class="heading">
       
       
          <xsl:if test="$currentPage/@id = '2378'">   
          <xsl:choose>
          <xsl:when test="$currentPage/@id = current()/@id">
          <a>
          <xsl:attribute name="id">currentMenuLink</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
          <xsl:value-of select="string(data [@alias='MenuItem'])"/>
          </a>
          </xsl:when>
          <xsl:otherwise>
          <a>
          <xsl:attribute name="id">heading</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
          <xsl:value-of select="string(data [@alias='MenuItem'])"/>
          </a>
          </xsl:otherwise>
          </xsl:choose>   
          </xsl:if>   

            <xsl:variable name="pageID">
            <xsl:choose>
              <xsl:when test="lnkCategoryPage &gt; 0">
                <xsl:value-of select="lnkCategoryPage" />
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@id" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <a href="{umbraco.library:NiceUrl($pageID)}" title="{string(txtMenuItem)}">
                <xsl:value-of select="@nodeName"/>
          </a>                         
      </div>
      <ul>
        <xsl:for-each select="./descendant::*">
          <xsl:if test="@id != ''">
            <li>         
               <xsl:choose>
                    <xsl:when test="$currentPage/@id = current()/@id">
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}" class="currentMenuLink">          
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:when>   
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}">          
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:otherwise>
               </xsl:choose>
            </li>
          </xsl:if>
        </xsl:for-each> 
      </ul>
    </xsl:for-each>
     
      <html>
       <BODY>
       <div class="heading">
     <div class="ebayImage">
            <a href="http://stores.ebay.com/Surplus-Group?_trksid=p2047675.l2563" target="_blank">Store</a>
       </div>
       </div>
       </BODY>
      </html>

     

    </xsl:template> 
    </xsl:stylesheet>

     

    Any help will be highly appreciated.

    regards,

    Partha

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 09, 2014 @ 14:20
    Dennis Aaen
    0

    Hi Partha,

    Which version of Umbraco are you using, and can you point out in your code where you want the the Menu Item field of the properties to be displayed instead of Name field.

    I assume that you are talking about this line.

    <a href="{umbraco.library:NiceUrl($pageID)}" title="{string(txtMenuItem)}">
          <xsl:value-of select="@nodeName"/>
    </a>         

    Looking forward to hear from you.

    /Dennis

  • Partha Ghosh 9 posts 64 karma points
    Dec 09, 2014 @ 14:42
    Partha Ghosh
    0

    Hi,

    I am using Umbraco 4 and I want the Menu item text to always display in the left navigation menu. You will get a better idea if you visit http://www.surplus-used-equipment.com/ . I want http://www.surplus-used-equipment.com/air-cooled-chillers.aspx to be displayed as http://www.surplus-used-equipment.com/used-air-cooled-chillers.aspx. But the left menu should continue to display Air Cooled Chiller. So, I want the  Menu Item to be used to create the left navigation menu instead of the name.

    regards,

    Partha

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 09, 2014 @ 14:52
    Dennis Aaen
    0

    Hi Partha,

    Could you please give us the exact version number of Umbraco 4 that you are using, the reason for that is that the XML schema has changed from version 4.5 of Umbraco, and this have some influence on how you should right your XSLT code.

    You can find the exact version number of Umbraco 4 that you are running by clicking the about button in the right corner of the Umbraco back office UI.

    /Dennis

  • Partha Ghosh 9 posts 64 karma points
    Dec 09, 2014 @ 15:30
    Partha Ghosh
    0

    Hi,

    It is 4.7.0

    Thanks,

    Partha

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 09, 2014 @ 15:37
    Dennis Aaen
    0

    Hi Partha,

    Seems that you have mixin the new and the old XML schema.

    I have tried updaed your code to the new XML schema, and where the propertyAlias is you need to change so it match the propertyAlias of your Menu Item, I think the propertyAlias could be menuItem,if you haven't changed it manually

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

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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) != '1' and string(chkShowInNavigation) = '1']">
      <div class="heading">
      
      
          <xsl:if test="$currentPage/@id = '2378'">  
          <xsl:choose>
          <xsl:when test="$currentPage/@id = current()/@id">
          <a>
          <xsl:attribute name="id">currentMenuLink</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
            <xsl:value-of select="propertyAlias"/>
          </a>
          </xsl:when>
          <xsl:otherwise>
          <a>
          <xsl:attribute name="id">heading</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
            <xsl:value-of select="propertyAlias"/>
          </a>
          </xsl:otherwise>
          </xsl:choose>  
          </xsl:if>  

            <xsl:variable name="pageID">
            <xsl:choose>
              <xsl:when test="lnkCategoryPage &gt; 0">
                <xsl:value-of select="lnkCategoryPage" />
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@id" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <a href="{umbraco.library:NiceUrl($pageID)}" title="{string(txtMenuItem)}">
                <xsl:value-of select="@nodeName"/>
          </a>                        
      </div>
      <ul>
        <xsl:for-each select="./descendant::*">
          <xsl:if test="@id != ''">
            <li>        
               <xsl:choose>
                    <xsl:when test="$currentPage/@id = current()/@id">
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}" class="currentMenuLink">         
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:when>  
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}">         
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:otherwise>
               </xsl:choose>
            </li>
          </xsl:if>
        </xsl:for-each>
      </ul>
    </xsl:for-each>
     
      <html>
       <BODY>
       <div class="heading">
     <div class="ebayImage">
            <a href="http://stores.ebay.com/Surplus-Group?_trksid=p2047675.l2563" target="_blank">Store</a>
       </div>
       </div>
       </BODY>
      </html>

    </xsl:template>
    </xsl:stylesheet>

    Hope this helps,

    /Dennis

  • Partha Ghosh 9 posts 64 karma points
    Dec 09, 2014 @ 15:56
    Partha Ghosh
    0

    Hi,

    Still not working, I replaced your XSLT with mine. Changed the name back to "Used Air-cooled Chillers" but the MenuItem to "Air-cooled Chillers". In the left menu of the side I have "Used Air-cooled Chillers"  appearing instead of "Air-cooled Chillers". Please see http://www.surplus-used-equipment.com

    regards,

    Partha

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 09, 2014 @ 16:11
    Dennis Aaen
    100

    Hi Partha,

    What if you are doing this,

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

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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) != '1' and string(chkShowInNavigation) = '1']">
      <div class="heading">
      
      
          <xsl:if test="$currentPage/@id = '2378'">  
          <xsl:choose>
          <xsl:when test="$currentPage/@id = current()/@id">
          <a>
          <xsl:attribute name="id">currentMenuLink</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
          <xsl:value-of select="string(data [@alias='MenuItem'])"/>
          </a>
          </xsl:when>
          <xsl:otherwise>
          <a>
          <xsl:attribute name="id">heading</xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
          <xsl:value-of select="string(data [@alias='MenuItem'])"/>
          </a>
          </xsl:otherwise>
          </xsl:choose>  
          </xsl:if>  

            <xsl:variable name="pageID">
            <xsl:choose>
              <xsl:when test="lnkCategoryPage &gt; 0">
                <xsl:value-of select="lnkCategoryPage" />
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@id" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <a href="{umbraco.library:NiceUrl($pageID)}" title="{string(txtMenuItem)}">
                <xsl:value-of select="txtMenuItem"/>
          </a>                        
      </div>
      <ul>
        <xsl:for-each select="./descendant::*">
          <xsl:if test="@id != ''">
            <li>        
               <xsl:choose>
                    <xsl:when test="$currentPage/@id = current()/@id">
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}" class="currentMenuLink">         
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:when>  
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}" title="{string(txtMenuItem)}">         
                        <xsl:value-of select="txtMenuItem"/>
                      </a>
                    </xsl:otherwise>
               </xsl:choose>
            </li>
          </xsl:if>
        </xsl:for-each>
      </ul>
    </xsl:for-each>
     
      <html>
       <BODY>
       <div class="heading">
     <div class="ebayImage">
            <a href="http://stores.ebay.com/Surplus-Group?_trksid=p2047675.l2563" target="_blank">Store</a>
       </div>
       </div>
       </BODY>
      </html>

    </xsl:template>
    </xsl:stylesheet>

    Hope this helps,

    /Dennis

  • Partha Ghosh 9 posts 64 karma points
    Dec 09, 2014 @ 16:20
    Partha Ghosh
    0

    Works fine. Thanks Dennis!

Please Sign in or register to post replies

Write your reply to:

Draft