Copied to clipboard

Flag this post as spam?

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


  • Jeff Kwong 31 posts 51 karma points
    May 15, 2010 @ 02:10
    Jeff Kwong
    0

    Creating a month header for a calendar of events

    I'm listing a sequence of items chronologically that have a date associated with them.  I'm trying to display the data like so (where the number before the dash is the day of the month):

     

    January

    11 - Item 1

    15 - Item 2

     

    February

    4 - Item 3

    7 - Item 4

     

    In the XSLT, how can I compare the month of each item with the last in my for-each loop to determine whether or not I display a new header?  Thanks in advance.

  • Dan 1288 posts 3921 karma points c-trib
    May 15, 2010 @ 09:07
    Dan
    0

    Hi Jeff,

    This has been tackled a couple of times on the forum.  There is more than one way to do it as well (Muenchian grouping, XPath Axis traversing etc).  The method you're looking for was done here: http://our.umbraco.org/forum/developers/xslt/6928-Grouping-nodes-by-Month.

    I've done this myself previously too but can't locate my forum post, so let me know if you need a hand with the code if you can't apply the stuff in the link above (or you could try googling for other forum posts on this topic as the search on this forum is a little unreliable).

    Hope this helps, and good luck with it...

  • Jeff Kwong 31 posts 51 karma points
    May 19, 2010 @ 19:11
    Jeff Kwong
    0

    Thanks, Dan!  I'll give this a gander!

Please Sign in or register to post replies

Write your reply to:

Draft