This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Grouping with XSLT
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Grouping with XSLT
- From: "Michael Geiling" <mgeiling at web dot de>
- Date: Wed, 31 Oct 2001 16:07:17 +0100
- Organization: http://freemail.web.de/
- Reply-To: xsl-list at lists dot mulberrytech dot com
I have some XML like
<dates>
<date>
<starth>10</starth>
<endh>12</endh>
<startm>15</startm>
<endm>30</endm>
<activity>Test</activity>
</date>
<date>
<starth>08</starth>
<endh>16</endh>
<startm>12</startm>
<endm>00</endm>
<activity>Test2</activity>
</date>
...
</dates>
and need to generate some sort of table (diary style) where I list the hours from 9-5 in a style like
9:00
9:15
9:30
9:45
10:00
...
Each line needs to get marked if some activity takes place; the lines between start and end need to be marked as well.
My XSL below groups the start times:
<xsl:template match="/">
<HTML>
<BODY>
<xsl:for-each select="//starth[not(. = following::starth)]">
<H2><xsl:value-of select="."/>:00</H2>
<xsl:for-each select="//date[starth=current()]">
<P>Start: <xsl:value-of select="starth"/>:<xsl:value-of select="startm"/>, <xsl:value-of select="activity"/></P>
</xsl:for-each>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
and produces the following html:
<HTML xmlns:xs="http://www.w3.org/2001/XMLSchema">
<BODY>
<H2>10:00</H2>
<P>
Start: 10:15, Test
</P>
<H2>12:00</H2>
<P>
Start: 12:00, Test2
</P>
</BODY>
</HTML>
However, I do not get the 11:00 marked although the time is blocked. Could someone please point me to the right construct ?
Thanks.
______________________________________________________________________________
Keinen Jackpot mehr verpassen! Mit dem Dauerschein des WEB.DE Lottoservice.
Einfach und bequem Lotto tippen! http://tippen2.web.de/?x=4
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list