Copied to clipboard

Flag this post as spam?

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


  • shufflemoomin 37 posts 36 karma points
    Jul 16, 2009 @ 17:30
    shufflemoomin
    0

    Check if node has children?

    Hi Everyone,

    I have some XSLT that need to check if a node is on a certain level and has children while looping through in a 'for each' loop. I have the following code:

    <xsl:if test="@level = 4">

    But I need to know what to add to that line of code so that it will check if the node is on a certain level AND has child nodes under it. Can anyone provide the code I'm missing to do this?

    Thanks

    Shufflemoomin

  • Lee 1123 posts 3059 karma points
    Jul 16, 2009 @ 17:35
    Lee
    0

    Could you add another <xsl:if test=""> under the current one with something like

    <xsl:if test="count(./node) &gt; 0">

    No idea if this syntax is correct as I'm a newbie to this .. LOL

  • Ron Brouwer 273 posts 768 karma points
    Jul 16, 2009 @ 17:51
    Ron Brouwer
    102

    Hope this helps:

    <xsl:foreach select="Your select[count(./node) != 0 and @level = 4]">
  • Lee 1123 posts 3059 karma points
    Jul 16, 2009 @ 18:00
    Lee
    0

    Well I was sort of close.. lol :)

  • Ron Brouwer 273 posts 768 karma points
    Jul 16, 2009 @ 18:27
    Ron Brouwer
    0

    If a reply results in your solution please select it as such. That way your post can be closed.

  • shufflemoomin 37 posts 36 karma points
    Jul 17, 2009 @ 10:30
    shufflemoomin
    0

    How do I do that Ron? Do I click on the tick button next to the posts that helped or just edit the topic to say solved?

  • shufflemoomin 37 posts 36 karma points
    Jul 17, 2009 @ 10:35
    shufflemoomin
    0

    I worked it out ron, just clicked the green check next to your post. Thanks a million for the help! :)

    Shufflemoomin

  • Ron Brouwer 273 posts 768 karma points
    Jul 17, 2009 @ 10:49
    Ron Brouwer
    0

    You're welcome!

  • 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