Hi, i have a top nav made in xslt and i want one of the nodes in the top nav to display a different name to what its actual page name is. Ive looked at xsl choose but can only find example of change the href or title of the node. Can you help me please????
BTW, my example above is a local nav structure. The Top Nav would be closer to this if you use the built-in Navigation XSLT pattern:
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="style">font-weight: bold;</xsl:attribute> </xsl:if> <xsl:choose> <xsl:whentest="@nodeName = 'nameToChange'"> New Name </xsl:when> <xsl:otherwise> <xsl:value-ofselect="@nodeName"/> </xsl:otherwise> </xsl:choose> </a> </li> </xsl:for-each>
change item in top nav
Hi, i have a top nav made in xslt and i want one of the nodes in the top nav to display a different name to what its actual page name is. Ive looked at xsl choose but can only find example of change the href or title of the node. Can you help me please????
Hi Phil,
I can't tell from your question whether this alternate name is stored in the data or hardcoded. Assuming you have a navigation similar to this:
If you want to hard-code it you can change it to something like this. (Where nameToChange is the name of the link you want to change)
If using another field you can either use the above and replace New Name with:
BTW, my example above is a local nav structure. The Top Nav would be closer to this if you use the built-in Navigation XSLT pattern:
Hi Phil,
I add an optional property to my documents and when it is populated I use that for the menu title. The XSLT then looks like:
Cheers
Paul
is working on a reply...