I've already created my XSLT but id like to be able to sort the data, also add some kind of index so i can group the items together, the difficulty Im having is the the node i want to sort by contains multiple values - values id like to sort by.
For example here is my XML:
<item>
<title>Item 1</title>
<subjects>English,Maths,Science,</subjects>
<description>Blah Blah Bah...</description>
</item>
<item>
<title>Item 2</title>
<subjects>Geography,Physical Education</subjects>
<description>Blah Blah Bah...</description>
</item>
<item>
<title>Item 3</title>
<subjects>History, Technology</subjects>
<description>Blah Blah Bah...</description>
</item>
<item>
<title>Item 4</title>
<subjects>Maths</subjects>
<description>Blah Blah Bah...</description>
</item>
So if i sort by <subjects>
I get this order:
English,Maths,Science,
Geography,Physical Education
History, Technology
Maths
But I would like this kind of output:
English
Geography
History
Maths
Maths
Physical Education
Science
Technology
Outputting the XML for each subject contained in <subjects>
, so Item1 contains subjects Maths, English & Science so I want to output that Title and Description 3 times because its relevant to all 3 subjects.
Whats the best way in XSLT to do this?