Some little typo caused the problem that the keys didn't work. Here is the
corrected stylesheet, should work right away...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<!-- should select all events for a given date -->
<xsl:key name="events-by-date" match="event"
use="substring(occurrences/occurrence/start,1,10)" />
<!-- should only select the events where
substring(occurrences/occurence/start, 12, 2) != '12' -->
<xsl:key name="events-by-date-main"
match="event[not(substring(occurrences/occurrence/start/text(), 12, 2) =
'12')]" use="substring(occurrences/occurrence/start,1,10)" />
<!-- should only select the events where
substring(occurrences/occurrence/start, 12, 2) == '12' and
substring(occurrences/occurence/start, 18, 2) == 'AM'-->
<xsl:key name="events-by-date-12am"
match="event[(substring(occurrences/occurrence/start/text(), 18, 2) =
'AM') and (substring(occurrences/occurrence/start/text(), 12, 2) = '12')]"
use="substring(occurrences/occurrence/start,1,10)" />
<!-- should only select the events where
substring(occurrences/occurence/start, 12, 2) == '12' and
substring(occurrences/occurence/start, 18, 2) == 'PM'-->
<xsl:key name="events-by-date-12pm"
match="event[(substring(occurrences/occurrence/start/text(), 18, 2) =
'PM') and (substring(occurrences/occurrence/start/text(), 12, 2) = '12')]"
use="substring(occurrences/occurrence/start,1,10)" />
<xsl:template match="events">
<root>
<xsl:apply-templates select="event[count(. | key('events-by-date',
substring(occurrences/occurrence/start,1,10))[1]) = 1]">
<xsl:sort select="substring(occurrences/occurrence/start,1,10)" />
</xsl:apply-templates>
</root>
</xsl:template>
<!-- this template should process all events with the same date as the
current event -->
<xsl:template match="event" >
<xsl:comment>selected by 12pm</xsl:comment>
<xsl:apply-templates select="key('events-by-date-12pm',
substring(occurrences/occurrence/start,1,10))" mode="sorted">
<xsl:sort select="substring(occurrences/occurrence/start,15,2)" />
</xsl:apply-templates>
<xsl:comment>selected by main</xsl:comment>
<xsl:apply-templates select="key('events-by-date-main',
substring(occurrences/occurrence/start,1,10))" mode="sorted">
<xsl:sort order="ascending"
select="substring(occurrences/occurrence/start,18,2)" />
<xsl:sort order="ascending"
select="substring(occurrences/occurrence/start,12,2)" />
<xsl:sort order="ascending"
select="substring(occurrences/occurrence/start,15,2)" />
</xsl:apply-templates>
<xsl:comment>selected by 12am</xsl:comment>
<xsl:apply-templates select="key('events-by-date-12am',
substring(occurrences/occurrence/start,1,10))" mode="sorted">
<xsl:sort order="ascending"
select="substring(occurrences/occurrence/start,15,2)" />
</xsl:apply-templates>
</xsl:template>
<xsl:template match="event" mode="sorted">
<!-- ... -->
</xsl:template>
</xsl:stylesheet>
Hope this helps
Christoph
If you are not the intended addressee, please inform us immediately that you
have received this e-mail by mistake and delete it. We thank you for your
support.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--