I'm a little confused, because you describe the XML that you have shown as the source XML, but your logic appears to be taking programme elements that each have a start attribute, and grouping those that have the same start time to create a start element for that start time - in other words it looks to me as if the XML you have shown is the output rather than the input of your transformation. In which case, congratulations, you have discovered the Muenchian grouping method which is one of the trickiest things to program in XSLT 1.0. It's much easier, however, in XSLT 2.0, which has an xsl:for-each-group instruction. There are still some environments where no XSLT 2.0 processor is available but you should be using XSLT 2.0 if you possibly can.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|