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
Hi,
I'm trying to create a subnavigation menu with XSLT.
I want, aside from showing all child nodes, I want a link back to the parent of the document.
I would also like to omit this back link on the home page.
<ul class="right-navi-list"><xsl:for-each select="$currentPage/ContentPage [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li></xsl:for-each> <xsl:variable name="parent" select="$currentPage/ancestor-or-self::*" /> <li> <a href="{umbraco.library:NiceUrl($parent/@id)}"> Back </a> </li></ul>
This is what I have tried so far,
but this just gives me a link to the current page.
Try this:
<xsl:if test="$currentPage/@level != 1"> <xsl:variablename="parent"select="$currentPage/parent::*"/> <li> <ahref="{umbraco.library:NiceUrl($parent/@id)}"> Back </a> </li></xsl:if>
Hi Elad
If you want to create a link to the parrent of the current page you can do like this:
<a href="{umbraco.library:NiceUrl($currentPage/../@id)}">Back</a>
The two dots ".." reffers to the parent node.
/Kim A
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Link back to parent
Hi,
I'm trying to create a subnavigation menu with XSLT.
I want, aside from showing all child nodes, I want a link back to the parent of the document.
I would also like to omit this back link on the home page.
<ul class="right-navi-list">
<xsl:for-each select="$currentPage/ContentPage [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
<xsl:variable name="parent" select="$currentPage/ancestor-or-self::*" />
<li>
<a href="{umbraco.library:NiceUrl($parent/@id)}">
Back
</a>
</li>
</ul>
This is what I have tried so far,
but this just gives me a link to the current page.
Try this:
<xsl:if test="$currentPage/@level != 1">
<xsl:variablename="parent"select="$currentPage/parent::*"/>
<li>
<ahref="{umbraco.library:NiceUrl($parent/@id)}">
Back
</a>
</li>
</xsl:if>
Hi Elad
If you want to create a link to the parrent of the current page you can do like this:
The two dots ".." reffers to the parent node.
/Kim A
is working on a reply...