I got a little issue with my menu on my site. i got my site in 3 different language, DK, DE and UK. On each site there is a page called the following things:
DK: Brochure UK: Download DE: Downloads
I generate my menu automaticly with the fllowing XSLT macro:
What i need to do is, when the macro reach on of the page I've told about further up i want to be able to output something else. I managed to do it with the following code:
The problem is that it only workds when I'm on the Brochure page, and I need it to display "Download" no matter what page i'm on. I hope you guys can help me!
Not excatly what I'm trying to achive. What I want is to permanente chage the displaying text for the node called "Brochure" no matter what page on my site I'm on. If you want to see the structure of my site, just let me know.
A little confused on exactly what you want, but wouldn't this be what you want?
<xsl:if test="@nodeName ='Brochure' or @nodeName = 'Downloads' or @nodeName = 'Download'"> Download </xsl:if>
Also, generally speaking it's probably not the best practice to go by the nodeName since it can be changed by editors (maybe not in your case)? If that page has its own document type you can test for that, and you'd only need one condition since all 3 sites would use the same doctype:
That was excatly what i was after! And thanks for the heads up on checking on Document type instead of nodeName. I could use the other one in another place on my site :)
Change menu item depending on nodeName
Hello fellow Umbraco-holics,
I got a little issue with my menu on my site. i got my site in 3 different language, DK, DE and UK. On each site there is a page called the following things:
DK: Brochure
UK: Download
DE: Downloads
I generate my menu automaticly with the fllowing XSLT macro:
<xsl:template match="/">
<!-- The fun starts here -->
<div class="menu_item">
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc and @nodeName='UK']">
<a class="menu_link" href="/">
<xsl:choose>
<xsl:when test="$currentPage/self::Frontpage">
<b><u>Home</u></b>
</xsl:when>
<xsl:otherwise>
Home
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:if>
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc and @nodeName='DK']">
<a class="menu_link" href="/dk.aspx">
<xsl:choose>
<xsl:when test="$currentPage/self::Frontpage">
<b><u>Forside</u></b>
</xsl:when>
<xsl:otherwise>
Forside
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:if>
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc and @nodeName='DE']">
<a class="menu_link" href="/de.aspx">
<xsl:choose>
<xsl:when test="$currentPage/self::Frontpage">
<b><u>Startseite</u></b>
</xsl:when>
<xsl:otherwise>
Startseite
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:if>
</div>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="menu_item">
<a class="menu_link" href="{umbraco.library:NiceUrl(@id)}">
<xsl:choose>
<xsl:when test="$currentPage/ancestor-or-self::*/@id = current()/@id">
<b><u><xsl:value-of select="@nodeName"/></u></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@nodeName"/>
</xsl:otherwise>
</xsl:choose>
</a>
</div>
</xsl:for-each>
</xsl:template>
What i need to do is, when the macro reach on of the page I've told about further up i want to be able to output something else. I managed to do it with the following code:
<xsl:if test="@nodeName ='Brochure'">
Download
</xsl:if>
The problem is that it only workds when I'm on the Brochure page, and I need it to display "Download" no matter what page i'm on. I hope you guys can help me!
Regards,
Mark W. Nielsen
Hi Mark,
Are you trying to display something else when hovering on a menu node?
If so what you can do is change this
<xsl:if test="@nodeName ='Brochure'">
Download
</xsl:if>
to
//fuji
Hey (again) Fuji,
Not excatly what I'm trying to achive. What I want is to permanente chage the displaying text for the node called "Brochure" no matter what page on my site I'm on. If you want to see the structure of my site, just let me know.
//Mark W. Nielsen :P
Please do so....
//fuji
A little confused on exactly what you want, but wouldn't this be what you want?
Also, generally speaking it's probably not the best practice to go by the nodeName since it can be changed by editors (maybe not in your case)? If that page has its own document type you can test for that, and you'd only need one condition since all 3 sites would use the same doctype:
-Tom
Hey Tom,
That was excatly what i was after! And thanks for the heads up on checking on Document type instead of nodeName. I could use the other one in another place on my site :)
You got your post marked as solution.
\\Mark W.
is working on a reply...