Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1461 posts 1883 karma points
    Mar 07, 2011 @ 10:37
    Gordon Saxby
    0

    Get NodeTypeAlias of parent node

    Using the new schema / 4.6.1 - how do I find out the "Node Type Alias" of the parent node?

    I just know this is going to be a jolly simple answer ... but my excuse is it's been a long weekend!

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 07, 2011 @ 10:44
    Kim Andersen
    0

    Hi Gordon

    Try this:

    <xsl:value-of select="$currentPage/../name()" />

    Does that help?

    /Kim A

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 07, 2011 @ 11:03
    Gordon Saxby
    0

    That gives an error - "Expected the end of expression, found '('"

    If I remove the "$currentPage/../" then it is OK!?

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 07, 2011 @ 11:15
    Kim Andersen
    0

    Ahh my bad Gordon. Was a bit to quick there.

    Try this instead:

    <xsl:value-of select="name($currentPage/..)" />

    /Kim A

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 07, 2011 @ 11:23
    Gordon Saxby
    0

    I think we got there at the same time!!

    I have used -

    <xsl:value-of select="name(..)" />

    Easy when you know how!! :-)

     

     

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 07, 2011 @ 11:29
    Kim Andersen
    0

    So you are doing this inside of a loop or?

    Otherwise I'm quite sure you'd need the $currentPage/ in the selection as well.

    /Kim A

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 07, 2011 @ 11:49
    Gordon Saxby
    0

    It is being used inside an XSLT template which needs to know what type of node it's parent is. In fact it is being used in an IF statement test. So, it is looking at the parent of the current node. The current node is not (necessarily) the same as the $currentPage.

    Of course, your solution works as well, but not in my specific situation :-)

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 07, 2011 @ 11:57
    Kim Andersen
    0

    Okay, makes sense, as you are using it on nodes that's being, in some way, iterated through. I thought that you needed to find it from the current page that you where currently standing on :)

    /Kim A

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 07, 2011 @ 12:14
    Gordon Saxby
    0

    Page specifically, no ... (parent of) current node, yes :-)

    It's a shame I can't mark my own post as the solution ... I'll be getting an email soon saying there's no solution for my post!! ;-)

Please Sign in or register to post replies

Write your reply to:

Draft