Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 886 posts 2415 karma points
    Sep 01, 2009 @ 09:47
    Claushingebjerg
    0

    a bit of syntax help

    Hi

    i have a variable:

    <xsl:variable name="numberOfRecords" select="count($currentPage/node)"/>

    But i would like it to test and only count the nodes where "date"  is greater than Currentdate. Like:

    (umbraco.library:FormatDateTime(data[@alias='date'],'yyyyMMdd') &gt;= umbraco.library:FormatDateTime(umbraco.library:CurrentDate(),'yyyyMMdd'))

    How do i combine the two into one?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Sep 01, 2009 @ 10:04
    Dirk De Grave
    1

    Hi Claushingebjerg,

    You're pretty close, just add the restriction as in:

    <xsl:variable name="numberOfRecords" select="count($currentPage/node [umbraco.library:FormatDateTime(data[@alias='date'],'yyyyMMdd') &gt;= umbraco.library:FormatDateTime(umbraco.library:CurrentDate(),'yyyyMMdd'))])"/>

     

    Hope this helps.

     

    Regards,

    /Dirk

  • horsted 70 posts 121 karma points
    Sep 01, 2009 @ 10:43
    horsted
    0

    Hi Dirk and other xslt-wizards,

    I (like Claus? :-) often have problems using/understanding restrictions when choosing nodes, and I tend to end up doing a 'for-each' with an 'if' instead to get the diseried nodes. I alwasy have a feeling, that it could have been made much simpler with restrictions, like in your example, so a Wiki explaning the syntax and some good example would help a lot of people i think :-) So hoping someone would take the time to write one...

    Thanks in advance!

    Cheers, horsted


     

  • 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