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
I have a multilanguage site with the following structure
=============================
mysite
-hr
--page 1
---sub page 1
--page 2
---sub page 2
-en
what I need to do is to select hr or en node depending on what page I'm currently on.
I tried to use
<xsl:value-of select="$currentPage/ancestor-or-self::node [@level=1]/node/@nodeName" />
but that always return me the first node and in this case it is the hr node. How can I select en when I'm in the pages bellow it?
Which version of Umbraco are you using?
I'm using version 4.5.1.
Hows about
<xsl:value-of select="$currentPage/ancestor-or-self::node [@nodeTypeAlias='yourHomepageAlias']" />
Or in the new schema (4.5 +)
<xsl:value-of select="$currentPage/ancestor-or-self::yourHomepageAlias[@isDoc]" />
Dan
Hi Mladen,
If your Content has the hr/en nodes at level 2 then you should stop at level 2 when walking the ancestor axis:
<xsl:value-of select="$currentPage/ancestor-or-self::*[@level = 2]/@nodeName" />
(This will work with both the "old" and the "new" Schema)
/Chriztian
Not tested as converted from pre 4.5 code but should work
<!--Get root of site regardless of where you are in site)<xsl:variable name="currentRoot" select="$currentPage/ancestor-or-self::root"/>
Rich
Thanks Ckriztian, your solution worked like a charm.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
get parent node
I have a multilanguage site with the following structure
=============================
mysite
-hr
--page 1
---sub page 1
--page 2
---sub page 2
-en
--page 1
---sub page 1
--page 2
---sub page 2
=============================
what I need to do is to select hr or en node depending on what page I'm currently on.
I tried to use
but that always return me the first node and in this case it is the hr node. How can I select en when I'm in the pages bellow it?
Which version of Umbraco are you using?
I'm using version 4.5.1.
Hows about
Or in the new schema (4.5 +)
Dan
Hi Mladen,
If your Content has the hr/en nodes at level 2 then you should stop at level 2 when walking the ancestor axis:
(This will work with both the "old" and the "new" Schema)
/Chriztian
Not tested as converted from pre 4.5 code but should work
<!--Get root of site regardless of where you are in site)
<xsl:variable name="currentRoot" select="$currentPage/ancestor-or-self::root"/>
Rich
Thanks Ckriztian, your solution worked like a charm.
is working on a reply...