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.
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).
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.
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...
Thanks, Dan! I'll give this a gander!
is working on a reply...