I know I can do this by using a for-each and preceeding-sibling, but I'd like to try Muenchian grouping for a more elegant solution. I've tried the following, but just can't get it to work:
Where 'article years' is the name of the key, 'JournalArticle' is the document type alias and 'articleDate' is the data type alias of the date I want to group by.
Can anyone suggest what I'm doing wrong? I suspect it's to do with the 'match' field, but I've tried a few different things here to no avail.
Is articleDate a datepicker? If so I think you might need to add some Date Formatting in there to get the year. Here's code from something similar I did that should get you started:
Just to help you get through your initial attempt and provide a "Simple Muenchian Grouping" example (if such a thing exists :-) - 'coz you were off to a great start, actually...
Is there any reason why the Muenchian grouping examples always use the count() / union method and not the generate-id method?
I have been trying to get my head round the whole thing and Jeni Tennison's article here offers both as options; however, the count() / union variation is almost invariably used in examples.
Is it more efficient or is it just a style thing? I find the generate-id method more intuitive to read, but that's probably because I suck at set arithmetic :o)
Simple Muenchian grouping
Hi,
I have a list of journal articles on my site. I'd like to show an archive of these, grouped by year, so my rendered HTML will be something like:
I know I can do this by using a for-each and preceeding-sibling, but I'd like to try Muenchian grouping for a more elegant solution. I've tried the following, but just can't get it to work:
Where 'article years' is the name of the key, 'JournalArticle' is the document type alias and 'articleDate' is the data type alias of the date I want to group by.
Can anyone suggest what I'm doing wrong? I suspect it's to do with the 'match' field, but I've tried a few different things here to no avail.
Thanks
Hi Dan,
Is articleDate a datepicker? If so I think you might need to add some Date Formatting in there to get the year. Here's code from something similar I did that should get you started:
-Tom
Great, with a few mods that's sorted it! Thanks Tom.
Hi Dan,
Just to help you get through your initial attempt and provide a "Simple Muenchian Grouping" example (if such a thing exists :-) - 'coz you were off to a great start, actually...
/Chriztian
A wonderful and very helpful reply, as always, thanks Chriztian.
Is there any reason why the Muenchian grouping examples always use the count() / union method and not the generate-id method?
I have been trying to get my head round the whole thing and Jeni Tennison's article here offers both as options; however, the count() / union variation is almost invariably used in examples.
Is it more efficient or is it just a style thing? I find the generate-id method more intuitive to read, but that's probably because I suck at set arithmetic :o)
@Rob: I have no idea - haven't tried to benchmark it - but now I'm curious, so I'll probably do some testing. Doubt there's much difference, though...
/Chriztian
is working on a reply...