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 4124 posts 22215 karma points MVP 9x 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 2798 posts 8788 karma points MVP 7x 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

Please Sign in or register to post replies

Write your reply to:

Draft