Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a content structure like this
HomeAbout Us School History Ethos & Aims BoardJunior One Two Etc...
I need to create nvaigation for each Section ie About Us, Junior etc - essentially 2ndLevelNavigation.
The problem I have is this.
The navigation for About Us and each of its child pages needs to be
About UsSchool HistoryEthos & AimsBoard
in other words the navigation needs to include the parent and the children.
In xslt how can you loop through both teh parent and the children and get them to appear in the Nav.
At the moment I am using the followign but it only works on the About Us page and not on the child pages.
<?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"/><xsl:variable name="level" select="2"/><xsl:template match="/">
<!-- The fun starts here --> <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <div class="nav_button_l"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </div></xsl:for-each>
</xsl:template>
</xsl:stylesheet>
PLEASE IGNORE THIS. THE POST HAS GONE WRONG AND IS UNCLEAR
AM REPOSTING
AM UNABLE TO DELETE OR EDIT AS IT IS ERRORING OUT
Juliang,
You can try using this
<xsl:value-of select="$currentPage/ancestor-or-self::*[@level = 1]/Content" />
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Include both parent and child at same level in navigation
I have a content structure like this
Home
About Us
School History
Ethos & Aims
Board
Junior
One
Two
Etc...
I need to create nvaigation for each Section ie About Us, Junior etc - essentially 2ndLevelNavigation.
The problem I have is this.
The navigation for About Us and each of its child pages needs to be
About Us
School History
Ethos & Aims
Board
in other words the navigation needs to include the parent and the children.
In xslt how can you loop through both teh parent and the children and get them to appear in the Nav.
At the moment I am using the followign but it only works on the About Us page and not on the child pages.
<?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"/>
<xsl:variable name="level" select="2"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="nav_button_l">
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
PLEASE IGNORE THIS. THE POST HAS GONE WRONG AND IS UNCLEAR
AM REPOSTING
AM UNABLE TO DELETE OR EDIT AS IT IS ERRORING OUT
Juliang,
You can try using this
is working on a reply...