Now I'm doing my first site, and I've met a problem. I made search on forum and find that I am not first who asked how to solve such issue. But even using existing examples I can't cope.
So I have such site's structure:
- Company profile
- cp_sub1
- cp_sub2
- cp_sub3
- Eco taxe
- et_sub1
- et_sub2
- Road network
- rn_sub1
- rn_sub2
For formation of top menu I use umbTopNavigation.xslt. I want to rewrite this xslt so that this xslt creates such html:
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
Multi-level menu
Hi all. I'm beginner in Umbraco CMS.
Now I'm doing my first site, and I've met a problem. I made search on forum and find that I am not first who asked how to solve such issue. But even using existing examples I can't cope.
So I have such site's structure:
- Company profile
- cp_sub1
- cp_sub2
- cp_sub3
- Eco taxe
- et_sub1
- et_sub2
- Road network
- rn_sub1
- rn_sub2
For formation of top menu I use umbTopNavigation.xslt. I want to rewrite this xslt so that this xslt creates such html:
<tr>
<td id="ListViewMenu_MenuItem_0" class="item item-with-popup">
<a href="/Company/" id="ListViewMenu_MenuItemHref_0">
<div class="item-text">Company profile</div>
</a>
<div class="underline">Company profile</div>
<div class="popup-panel-border">Company profile</div>
<div class="popup-panel">
<div class="sub-menu">
<a href='/Company/cp_sub1.aspx'>
<div>cp_sub1</div>
</a>
<a href='/Company/cp_sub2.aspx'>
<div>cp_sub2</div>
</a>
<a href='/Company/cp_sub3.aspx'>
<div>cp_sub3</div>
</a>
</div>
</td>
<td id="ListViewMenu_MenuItem_0" class="item item-with-popup">
<a href="/EcoTaxe/" id="ListViewMenu_MenuItemHref_1">
<div class="item-text">Eco taxe</div>
</a>
<div class="underline">Eco taxe</div>
<div class="popup-panel-border">Eco taxe</div>
<div class="popup-panel">
<div class="sub-menu">
<a href='/EcoTaxe/et_sub1.aspx'>
<div>et_sub1</div>
</a>
<a href='/EcoTaxe/et_sub2.aspx'>
<div>et_sub2</div>
</a>
</div>
</td>
<td id="ListViewMenu_MenuItem_0" class="item item-with-popup">
<a href="/RoadNetwork/" id="ListViewMenu_MenuItemHref_2">
<div class="item-text">Road network</div>
</a>
<div class="underline">Road network</div>
<div class="popup-panel-border">Road network</div>
<div class="popup-panel">
<div class="sub-menu">
<a href='/RoadNetwork/rn_sub1.aspx'>
<div>rn_sub1</div>
</a>
<a href='/RoadNetwork/rn_sub2.aspx'>
<div>rn_sub2</div>
</a>
</div>
</td>
</tr>
I've google for a day, found many examples, but alas still can't solve this issue.
Hi
just use these XSLT.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<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"/>
<!-- Input the documenttype you want here -->
<!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
<!-- Use div elements around this macro combined with css -->
<!-- for styling the navigation -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul >
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
<!-- Drop Down Menu -->
<xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) > 0">
<ul>
<xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
</xsl:for-each>
</ul>
</xsl:if>
<!-- End of Drop Down Menu -->
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Thank You! It really works=)
is working on a reply...