Copied to clipboard

Flag this post as spam?

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


  • gerald diva 11 posts 31 karma points
    Nov 24, 2010 @ 01:45
    gerald diva
    0

    Counting the number of nodes with condition

    Hi,

    I am trying to count the total number of nodes with the nodeTypeAlias='Topic' with this code:

     

    <xsl:variable name="c" select="round(count($currentPage/ancestor-or-self::root//node [@nodeTypeAlias='Topic']/node) div 3)"/>

     

    Now I need to put a condition so that it only counts when a certain node datatype is true

     

    <xsl:variable name="c" select="round(count($currentPage/ancestor-or-self::root//node [@nodeTypeAlias='Topic' and string($currentPage/data[@alias='MoreSports']) = '1']/node) div 3)"/>

    But it is not working. Can someone help me with this. Thanks.

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 24, 2010 @ 01:53
    Chriztian Steinmeier
    0

    Hi gerald,

    Try this (getting rid of the extra $currentPage):

    <xsl:variable name="c" select="round(count($currentPage/ancestor-or-self::root//node[@nodeTypeAlias = 'Topic'][data[@alias = 'MoreSports'] = 1]/node) div 3)"/>

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft