Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Mar 26, 2011 @ 06:56
    Tom
    0

    In Loop How Do I Check if node is a given doc type

    Hi guys.. under the new schema in a loop how do i check if the current node is a given doc type

     

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
          <li>
           <xsl:if test="@id = $currentPage/@id">
            <xsl:attribute name="class">current</xsl:attribute>
          </xsl:if>
        <class="navigation" href="{umbraco.library:NiceUrl(@id)}">
          <span><xsl:value-of select="@nodeName"/></span>
        </a>
      </li>
    </xsl:for-each>

    Inside that for-each I'd love to do a check like

    <xsl:if test="./data [@nodeTypeAlias = 'SomeNode']"><xsl:call-template name="moo"/></xsl:if>
  • Rich Green 2246 posts 4008 karma points
    Mar 26, 2011 @ 07:27
    Rich Green
    1

    Hi Tom,

      <xsl:if test="name()='NameOfContentType'">
           Insert code here               
      </xsl:if>

    Rich

  • Daniel Bardi 927 posts 2562 karma points
    Mar 26, 2011 @ 08:12
    Daniel Bardi
    1

    I think you can also do this:

      <xsl:if test="self::NameOfContentType">
           Insert code here               
      </xsl:if>

Please Sign in or register to post replies

Write your reply to:

Draft