Get parent as well as child nodes in navigation macro
Hi folks,
I have a macro to allow for active states on the current page. The code is below. Currently, this displays all level 1 pages. I just want to tweak it to show the parent page (home) aswell. Can anyone please suggest a solution?
Get parent as well as child nodes in navigation macro
Hi folks,
I have a macro to allow for active states on the current page. The code is below. Currently, this displays all level 1 pages. I just want to tweak it to show the parent page (home) aswell. Can anyone please suggest a solution?
<?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="maxLevelForSitemap" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$maxLevelForSitemap]/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:choose>
<xsl:when test="@id = $currentPage/@id">
<a class="navactive" href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</xsl:when>
<xsl:otherwise>
<a class="navinactive" href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Hi David
Try this:
/Kim A
is working on a reply...