Hey.
iam tryning to get the following topnavination menu convertede to a XSLT dut iam not so dam good in version 7 yet.
this is the one i use in my version 6 site in the scripting files.
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
@*Get the toot og the website *@
var root = Model.AncestorOrSelf(1).Children.Where("Visible");
}
<ul>
<li><a href="/">FORSIDE</a></li>
@foreach (var page in root)
{
<li class="@page.IsAncestorOrSelf(Model, "current-menu-item", "")">
<a href="@page.Url">@page.Name</a>
@* check if page has chrildren *@
@if (page.Children.Where("Visible").Count() > 0)
{
<ul>
@foreach (var subpage1 in page.Children.Where("Visible"))
{
<li>
<a href="@subpage1.Url">@subpage1.Name</a>
}
</li>
}
</ul>
}
</li>
}
</ul>
I love to get it over to XSLT. and i dit try but i cant get it to work.
<?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:Examine="urn:Examine"
exclude-result-prefixes="msxml umbraco.library Examine ">
<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="/">
<!-- The fun starts here -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" class="" data-toggle="dropdown">Velkommen</a>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '0']">
<li class="dropdown">
<a href="{umbraco.library:NiceUrl(@id)}" class="dropdown-toggle" data-toggle="dropdown"><xsl:value-of select="@nodeName"/></a>
<ul class="dropdown-menu">
<li class="">
<a href="{umbraco.library:NiceUrl(@id)}" class="dropdown-toggle" data-toggle="dropdown"><xsl:value-of select="@nodeName"/></a>
</li>
</ul>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
i hope som can help me..
i noly need it to list subpages one lvl down
like this.
page
pagesub
Michael
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/73298-dropdown-topnavigation-problem