This is my problem: I'm trying to create a title for my menu that shows what node you're in, which I've managed to do. The problem is I want to make it a link and can't seem to do it! Can anyone help?
That throws up an error: System.Xml.XmlException: '$' is an unexpected token. The expected token is '"' or '''
And doesn't work if I skip testing.
Basically, I have a top menu and left hand menu. The top menu is the level 2 nodes of the site and then the left hand menu is levels 3, 4 and 5.
At the top of the menu, I want to display the area of the site the user is in. E.g if they're in a page under the about us section, no matter what level of the section they're in, the menu says "About Us" at the top and it's a link to about us.
Putting the following code in produced the correct section the user was navigating, but I don't know how to turn it into a link...
I'm using umbraco v
4.0.4.2 (Assembly version: 1.0.3811.17115) if that makes any difference?
Link to level 2 node
Hi everyone,
I'm sure this is really simple to do, but for some reason it's really stumping me.
I've posted the problem here, but I think it's getting overlooked as I've tagged it onto the end of an old thread:
http://our.umbraco.org/forum/developers/xslt/3682-How-to-get-the-parent-node-name-on-a-specific-level-from-current-page
This is my problem:
I'm trying to create a title for my menu that shows what node you're in, which I've managed to do. The problem is I want to make it a link and can't seem to do it! Can anyone help?
Here's my code so far:
<h1>
<xsl:value-of select="$currentPage/ancestor-or-self::node [@level=2]/@nodeName" />
</h1>
Thanks in advance for any help given!
Tom
Hi Tom,
not sure if i really understand your problem, but as far is a understand, you get the right @nodeName now and only want to add a link? If so, try this
<xsl:param name="rightNode" select="$currentPage/ancestor-or-self::node [@level=2]" />
<h1>
<a href="{umbraco.library:NiceUrl($rightNode/@id)}"> <xsl:value-of select=$rightNode/@nodeName /></a>
</h2>
Hope this helps,
gr. Walter
Hi Walter,
That throws up an error:
System.Xml.XmlException: '$' is an unexpected token. The expected token is '"' or '''
And doesn't work if I skip testing.
Basically, I have a top menu and left hand menu. The top menu is the level 2 nodes of the site and then the left hand menu is levels 3, 4 and 5.
At the top of the menu, I want to display the area of the site the user is in. E.g if they're in a page under the about us section, no matter what level of the section they're in, the menu says "About Us" at the top and it's a link to about us.
Putting the following code in produced the correct section the user was navigating, but I don't know how to turn it into a link...
I'm using umbraco v 4.0.4.2 (Assembly version: 1.0.3811.17115) if that makes any difference?
Thanks,
Tom
Ahhh
<xsl:value-of select=$rightNode/@nodeName /> needed to be <xsl:value-of select="$rightNode/@nodeName"/>
And it throws up some error about integers, but if I skip testing it works.
Thanks, Walter!
Tom
Solved the error problem with a bit of digging.
It needed an if statement wrapped around it to make sure the system was checking for the correct type of value.
Final code:
<xsl:param name="rightNode" select="$currentPage/ancestor-or-self::node [@level=2]" />
<h1>
<xsl:if test="$rightNode != '' ">
<a href="{umbraco.library:NiceUrl($rightNode/@id)}">
<xsl:value-of select="$rightNode/@nodeName"/>
</a>
</xsl:if>
</h1>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.