Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Amir Khan 1282 posts 2739 karma points
    Mar 13, 2012 @ 16:31
    Amir Khan

    Change nav item based on whether its a child of a certain parent.

    Hi, I have a multilingual site with an English node and a Spanish node, I'm trying to switch the "Home" link in my nav based on which document you're under and can't seem to figure it out using an xsl:when statement, any idea where I'm going wrong?

    Here's what I've been workign with:

    <xsl:param name="source" select="1062" />

            <xsl:when test="umbraco.library:GetXmlNodeById($source)/DocType">
                <li><a href="/en">Home</a></li>        
                <li><a href="/es">Spanish Home</a></li>

    Thanks for your help!


  • Ernst Utvik 123 posts 235 karma points
    Mar 13, 2012 @ 21:32
    Ernst Utvik

    If your setup has two different root nodes, one for the english site  and one for the spanish, a link to the root node should change depending on wich tree you are on. Example below with dictionary item for the link text.

    <xsl:variable name="root" select="$currentPage/ancestor-or-self::* [@level = 1]"/>
    <a href="{umbraco.library:NiceUrl($root/@id)}">
          <xsl:value-of select="umbraco.library:GetDictionaryItem('Home')" />

    You need to set your hostnames for this setup to work: Example add domain with language english to "en" node.

Please Sign in or register to post replies

Write your reply to: