Copied to clipboard

Flag this post as spam?

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


  • Daniel Horn 319 posts 344 karma points
    Nov 24, 2010 @ 13:22
    Daniel Horn
    0

    Getting the ancestor but only of a specific level

    Hi

    I have this structure

    content

    - Website

    -- Solutions

    --- SolutionGroup1

    ---- Solution1

    ---- Solution2

    --- SolutionGroup2

    ---- Solution4

     

    No matter what page under Solutions i am, whether its Solution1 or SolutionGroup1 I need to output the ancestor Solutions (level2) - how do I do this?

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 24, 2010 @ 13:27
    Chriztian Steinmeier
    0

    Hi Daniel,

    You almost said it yourself...

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

    /Chritztian

  • Daniel Horn 319 posts 344 karma points
    Nov 24, 2010 @ 13:35
    Daniel Horn
    0

    Hi again ;),

    That was also my first thought, but i get this output:

    Løsninger0LøsningerLøsningerERP0ERPERPDynamics0DynamicsDynamicsNAV0NAVNAVCRM0CRMCRM

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 24, 2010 @ 13:44
    Chriztian Steinmeier
    1

    Yeah - OK, that's just the complete text() content of that node - you should of course select the item you want to output, e.g.:

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

    /Chriztian 

  • Daniel Horn 319 posts 344 karma points
    Nov 24, 2010 @ 13:47
    Daniel Horn
    0

    But then its not dynamic? :(

    EDIT: Nevermind, it is - but I don't understand it. - You have to teach me about it at next XSLTPPF... 

  • 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