...but I am struggling to work out how it would be done.
I thought I would be able to do it by assigning the sport to a variable and then only outputting the 'Sport is XXXX' line if the next record changed but I'm not sure how to do that as I am so new to XSLT.
If there are any guru's able to help I would be most grateful.
It's late on a Sunday night and my understanding of it is just above zero but somehow I have managed to push the right buttons and get the output I require....I think.
This is what I've ended up with, just needs some tidying.
...and listing all my sporting events nicely grouped by sport e.g.
Chess Grand Master Football FA Cup Final 2010 World Cup Semi-Final 2010 World Cup Final Rugby Rugby Junior League
However during recent testing I discovered that if I set the umbracoNaviHide = true on the 'FA Cup Final' event, all the events under the Football disappear.
I have fixed it by moving the umbracoNaviHide!= '1' logic to an IF test later on but it feels a bit hacky.
Struggling with Variables/Parameters - Maybe
Hello all,
I have the following XSLT which will list out some sporting events I have created content for sorted by the sport type and date..
My Event Document Type has an ultimate picker allowing me to choose what sport the event is for.
The rendered output will look something like this:
What I would like to do is change the output so that it does not repeat the type of sport if it is the same. Like so...
...but I am struggling to work out how it would be done.
I thought I would be able to do it by assigning the sport to a variable and then only outputting the 'Sport is XXXX' line if the next record changed but I'm not sure how to do that as I am so new to XSLT.
If there are any guru's able to help I would be most grateful.
Regards,
Matt
Hi Matt,
There are neater ways to do it (try looking up the Muenchian method) but I did a similar thing to this to group articles under month headings a while back. Hopefully you'll find this post useful: http://our.umbraco.org/forum/developers/xslt/8098-Get-property-of-sibling-within-loop.
Hi Matt, for more info and grouping example of the Munchean method that Dan mentions take a look here:
http://blackpoint.dk/umbraco-workbench.aspx?Snippet=/umbraco-workbench/xslt/grouping--distinct-values.aspx
It's really a powerful approach, but requires you to understand xslt keys and id's (also explained on the site)
>Tommy
Hello Dan,
Thank you for your reply.
I looked at your posting and followed it without any problem.
Unfortunarley when I tried it I found the use of preceeding-sibling was no good due to the way my content is organised.
All the event items are in separate folders to make administration easier and in most cases the preceeding-sibling is nothing.
Events
- 2010
-- January
--- 2010 World Cup Semi-Final
--- 2010 World Cup Final
-- February
--- FA Cup Final
- 2009
-- January
--- Rugby Junior League
-- February
--- Grand Master
Is these some way I can store the previous sport value in a variable?
Regards,
Matt
Thanks for the link Tommy.
It's late on a Sunday night and my understanding of it is just above zero but somehow I have managed to push the right buttons and get the output I require....I think.
This is what I've ended up with, just needs some tidying.
Thanks again guys.
Hi Matt, hope you got it working - unless don't hesitate to ask
>Tommy
Hello all,
I'm back again with a query about this Muenchian method.
This code was all working well...
...and listing all my sporting events nicely grouped by sport e.g.
Chess
Grand Master
Football
FA Cup Final
2010 World Cup Semi-Final
2010 World Cup Final
Rugby
Rugby Junior League
However during recent testing I discovered that if I set the umbracoNaviHide = true on the 'FA Cup Final' event, all the events under the Football disappear.
I have fixed it by moving the umbracoNaviHide!= '1' logic to an IF test later on but it feels a bit hacky.
I'm sure there's a better way to do it. Does anyone have any suggestions?
Thanks, Matt
is working on a reply...
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.