The reason it's not showing the startpage is the XPath in the for-each loop is selecting the Startpage (ancestor-or-self::* [@level=1]), then selecting all nodes beneath it (/* ...)
I think most people typically add in their "start page" link manually, before the for-each loop, since the URL is usually just "/". Example:
Newbie - navigation issue
Hi -
Playing with my first Umbraco install. I have a navigation structure like:
-Startpage
--About
--Services
--Contact
And so on.
Using the Xslt "navigation by level" template I cant get the Startpage to show up in navigation menu.
The other menu items show just fine.
Any idea on how I can also show "Startpage" ?
Code from template;
<?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"
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"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<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>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Kind r
Bjørn.
Ho Bjørn,
The reason it's not showing the startpage is the XPath in the for-each loop is selecting the Startpage (ancestor-or-self::* [@level=1]), then selecting all nodes beneath it (/* ...)
I think most people typically add in their "start page" link manually, before the for-each loop, since the URL is usually just "/". Example:
Hope this helps,
Tom
Hi -
That worked. So easy. Thank you :)
is working on a reply...