Copied to clipboard

Flag this post as spam?

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


  • Neil 1 post 21 karma points
    Aug 20, 2009 @ 17:54
    Neil
    0

    XSLT Ancestor question

    Hi,

    I am looking to call a template based upon whether or not the current page is descended from a page with a particular ID. eg:

    if the current page or any of it's ancestors do not have an ID of 999
       call template
    end if

    I know I need to use the ancestor-or-self axis but am confused as to how I combine a select with an if to get the desired results.

    Any help would be much appreciated.

    Thanks

    Neil

  • dandrayne 1138 posts 2262 karma points
    Aug 20, 2009 @ 17:59
    dandrayne
    2

    RenderTemplate(Int32 PageId) might do it in xslt

    This might work

    <xsl:if test="$currentPage/ancestor-or-self::node/@id = '1060'">
    <xsl:value-of select="umbraco.library:RenderTemplate()" />
    </xsl:if>
  • dandrayne 1138 posts 2262 karma points
    Aug 20, 2009 @ 18:02
    dandrayne
    1

    or of course if your test is "does not"

    <xsl:if test="$currentPage/ancestor-or-self::node/@id != '999'">
    </xsl:if>
  • 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