I have around 300 documents in my content tree which I would like to group by first letter i.e.
A
Adams, Alister
B
Barry, Barnes,Belfry
C
Chad, Chester
etc...
I have written some xslt which takes a letter as a parameter and will output the docs for that letter, however I need to call it 26 times (once for each letter) which doesn't sit well with me!
Are there any XSLT gurus out there who can shed some light on a best practice way of doing this?
Hey just thought I'd add a little appreciation for Seans code too. Just adapted it for a similar purpose (although I'm using all tags in a group as my list source) and it works a treat. Wicked! Thanks.
List documents grouped by first letter
I have around 300 documents in my content tree which I would like to group by first letter i.e.
A
Adams, Alister
B
Barry, Barnes,Belfry
C
Chad, Chester
etc...
I have written some xslt which takes a letter as a parameter and will output the docs for that letter, however I need to call it 26 times (once for each letter) which doesn't sit well with me!
Are there any XSLT gurus out there who can shed some light on a best practice way of doing this?
There are some grouping samples and threads available, see http://our.umbraco.org/forum/developers/xslt/2988-Help-grouping-and-sorting-by-category
Or take a look into the grouping example here: http://blackpoint.dk/umbraco-workbench/xslt/grouping--distinct-values.aspx?p=3
hth, Thomas
Here is an example I use for a glossary listing
It basically takes the first letter of the node name and uses that to find all siblings that start with the same
You could also organise the docs in "alphabet folders" in the backend for the benefit of admins using something like http://our.umbraco.org/projects/developer-tools/autofolders, then the xslt becomes very simple as a side-result
Hi bayshield,
If you already have the code for finding and writing, then you can use this setup to do the alphabet-walk:
/Chriztian
Thanks for the input guys! Sean's XSLT worked a treat!
Hey just thought I'd add a little appreciation for Seans code too. Just adapted it for a similar purpose (although I'm using all tags in a group as my list source) and it works a treat. Wicked! Thanks.
Dave
is working on a reply...