A total newbie to Umbraco and XSLT. I searched the forum and found this http://wifi.umbraco.org/forum/developers/xslt/5975-String-manipulation However my situation is slightly different from the one in that post. And also I literally copied the exact code as Criztian had put but didn't work for me. So it's best I just create a fresh post regarding my situation.
Right, to cut the long story short. Here is what I want. I have a node called Educations which has child nodes of the various courses/educations. I simply want to show all the courses in groups of alphabet and also sort them. So something like this:
A Course Name Course Name Course Name
B Course Name Course Name Course Name
...
and the list continues with all the alphabets however if there is no course that starts with a certain alphabet like say "X" then it shouldn't show an empty group. I'm pretty sure this is possible with xslt but have no idea how to go about doing it. So you gurus out there, pleeeeeeease help a newbie out. :)
What I don't understand is where you have <xsl:key name="nodes" match="Educations/Textpage" use="substring(@nodeName, 1, 1)" /> what values are in "match" is it ParentNodeName/ChildDocType?
The Educations node and the child nodes(inidividual courses) are of document type "Textpage" so wherever you had put Courses I replaced it with Textpage as per your instructions
How to Group & Sort nodes alphabetically
Hi,
A total newbie to Umbraco and XSLT.
I searched the forum and found this http://wifi.umbraco.org/forum/developers/xslt/5975-String-manipulation
However my situation is slightly different from the one in that post. And also I literally copied the exact code as Criztian had put but didn't work for me. So it's best I just create a fresh post regarding my situation.
Right, to cut the long story short. Here is what I want. I have a node called Educations which has child nodes of the various courses/educations. I simply want to show all the courses in groups of alphabet and also sort them. So something like this:
A
Course Name
Course Name
Course Name
B
Course Name
Course Name
Course Name
...
and the list continues with all the alphabets however if there is no course that starts with a certain alphabet like say "X" then it shouldn't show an empty group. I'm pretty sure this is possible with xslt but have no idea how to go about doing it. So you gurus out there, pleeeeeeease help a newbie out. :)
Thanks,
Wasim
Hi Wasim,
This should work for you - you need to change the educations variable to point to your Educations node.
You should also change "Course" to the name of the Document Type of your individual courses.
If you're not using @nodeName for the course names you should change those too.
/Chriztian
Hi Chriztian,
I tried your code but still there is no ouptut. Here is my code:
What I don't understand is where you have <xsl:key name="nodes" match="Educations/Textpage" use="substring(@nodeName, 1, 1)" /> what values are in "match" is it ParentNodeName/ChildDocType?
The Educations node and the child nodes(inidividual courses) are of document type "Textpage" so wherever you had put Courses I replaced it with Textpage as per your instructions
Hope I can get a quick response.
Thanks,
Wasim
Finally got it to work. Thanks!
is working on a reply...