Copied to clipboard

Flag this post as spam?

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


  • Vincent Ashby-Smith 67 posts 196 karma points
    Jan 15, 2010 @ 19:23
    Vincent Ashby-Smith
    0

    How to test if node belongs to parents node

    Hi all i'm building a site where i need to test if a node belongs to a parent node, so for example say i have a News List with Monthly folders, i need to see if a news item belongs to a certain monthly folder, so something like does news item 1 sit under the january folder. I know you can get the parent node id but how can i test to see if a node belongs to that particular parent node?

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 15, 2010 @ 19:42
    Lee Kelleher
    0

    Hi Vincent,

    Inside your <xsl:for-each> loop, you can try the following:

    <xsl:for-each select="//node">
        <xsl:if test="parent::node[@nodeName = 'January']">
            <xsl:value-of select="." />
        </xsl:if>
    </xsl:for-each>

    I've used @nodeName as an example, but you can use whatever else is available - probably @nodeTypeAlias is better?

    Cheers, Lee

  • Vincent Ashby-Smith 67 posts 196 karma points
    Jan 15, 2010 @ 21:18
    Vincent Ashby-Smith
    0

    Hi Lee cheers for that, i changed it round a bit but that got me started!!

Please Sign in or register to post replies

Write your reply to:

Draft