Copied to clipboard

Flag this post as spam?

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


  • Phil Crowe 192 posts 256 karma points
    Oct 28, 2010 @ 16:55
    Phil Crowe
    0

    if parent name is this, show this...

    How can i say do something if the parent name of the currentNode is 'theParent'. I thought this would work below:

    <xsl:choose>

    <xsl:when test="$currentPage/parent::node[@nodeName = 'theParent']"> 

    //do this 

     

    </xsl:when>

         <xsl:otherwise>

    /do seomthing else

         </xsl:otherwise>

     

    </xsl:choose>

    But it doesnt.

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Oct 28, 2010 @ 17:43
    Lee Kelleher
    0

    Hi Phil,

    The logic looks correct to me.  Quick check, are you using the new XML schema? (in v4.5+) If so, try this instead:

    <xsl:when test="$currentPage/parent::*[@isDoc and @nodeName = 'theParent']"> 

    Cheers, Lee.

  • Phil Crowe 192 posts 256 karma points
    Oct 28, 2010 @ 17:59
    Phil Crowe
    0

    Hi Lee, yes thanks this i am using the new schema and your suggestion worked. Where can i read up on the differences with the new schema?

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Oct 28, 2010 @ 18:06
    Lee Kelleher
    0

    Hi Phil,

    I wrote a blog post about it a while back: http://blog.leekelleher.com/2010/04/02/working-with-xslt-using-new-xml-schema-in-umbraco-4-1/

    In a nutshell... for "nodes" the @nodeTypeAlias is now the element name and has a new attribute called "isDoc"  ... and for "data", the @alias is now the element name.

    Cheers, Lee.

  • Rich Green 2246 posts 4006 karma points
    Oct 28, 2010 @ 18:10
  • 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