Copied to clipboard

Flag this post as spam?

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


  • Shaun 248 posts 475 karma points
    Mar 26, 2010 @ 17:59
    Shaun
    0

    Finding out who my ancestors are

    Hi

    I have a site with pages at multiple levels, I think it goes 5 deep at one point.

    I want to write some xslt that will tell me on each page what that pages level2 ancestor is.

    I've messed around with

     

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=2]/node [string(data [@alias='umbracoNaviHide']) != '1']"><xsl:value-of select="@id"/></xsl:for-each>

     

    but it just seems to give me unrelated nodes. I only want to know the name of the ancestor node at level 2. Can anyone help?

    Thanks

    Shaun

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Mar 26, 2010 @ 18:30
    Chriztian Steinmeier
    1

    Hi Shaun,

    <xsl:value-of select="$currentPage/ancestor-or-self::node[@level = 2]/@nodeName" />

    It's that easy :-)

    /Chriztian

  • Shaun 248 posts 475 karma points
    Mar 27, 2010 @ 13:32
    Shaun
    0

    Aha!

    Boy do I feel dumb now.

    Thanks Chriztian!

  • 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.

Please Sign in or register to post replies