Copied to clipboard

Flag this post as spam?

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


  • lingjing 28 posts 45 karma points
    Jul 13, 2010 @ 13:40
    lingjing
    0

    How to only select first level node?

    Hi All. I am having problem to select only first level child nodes. Could anyone give me some idea?

    Thank you

  • Matt Brailsford 2958 posts 15629 karma points MVP 7x c-trib
    Jul 13, 2010 @ 13:42
    Matt Brailsford
    0

    Hey,

    Do you want to post the code you have and we can see where things are going wrong?

    Matt

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Jul 13, 2010 @ 13:51
    Chriztian Steinmeier
    2

    Hi lingjing,

    You could start with this and tweak it to your liking (it's compatible with the XML format of 4.0 as well as 4.5):

    <xsl:variable name="level1" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
    <xsl:template match="/">
        <xsl:apply-templates select="$level1/node" />
        <xsl:apply-templates select="$level1/*[@isDoc]" />
    </xsl:template>
    
    <xsl:template match="node | *[@isDoc]">
        <p>
            <xsl:value-of select="@nodeName" />
        </p>
    </xsl:template>
    

    /Chriztian 

  • lingjing 28 posts 45 karma points
    Jul 13, 2010 @ 22:53
    lingjing
    0

    Thanks Chriztiain. you solved my problem

  • 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