Merge branch 'master' of caffeine.uwaterloo.ca:/users/www/www
[mspang/www.git] / xsl / ics.xsl
1 <xsl:stylesheet version="1.1"
2     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3     xmlns:csc="http://csclub.uwaterloo.ca/xsltproc"
4     xmlns="http://www.w3.org/1999/xhtml"
5     exclude-result-prefixes="csc">
6
7 <xsl:output method="text" encoding="ISO-8859-1" />
8
9 <xsl:template match="//eventdefs">BEGIN:VCALENDAR
10 VERSION:2.0
11 X-WR-CALNAME:University of Waterloo Computer Science Club
12 PRODID:-//Apple Computer, Inc//iCal 2.0//EN
13 X-WR-RELCALID:3359A191-B19E-4B53-BADC-DFC084FC51C9
14 CALSCALE:GREGORIAN
15 METHOD:PUBLISH
16 <xsl:for-each select="eventitem"><xsl:call-template name="eventitem" /></xsl:for-each>
17 END:VCALENDAR
18 </xsl:template>
19
20 <xsl:template name="eventitem">
21 <xsl:variable name="room" select="@room" />
22 <xsl:variable name="start" select="csc:ical-datetime(@date, @time)" />
23 <xsl:variable name="end" select="csc:ical-datetime(@date, @time, 60)" />
24 <xsl:variable name="title" select="csc:ical-escape(@title)" />
25 <xsl:variable name="short" select="csc:ical-escape(string(short))"  />
26 <xsl:variable name="abstract" select="csc:ical-escape(string(abstract))" />
27 BEGIN:VEVENT
28 LOCATION:University of Waterloo - <xsl:value-of select="$room" />
29 DTSTAMP:20060912T200708Z
30 UID:<xsl:value-of select="$start" />@csclub.uwaterloo.ca
31 SEQUENCE:11
32 DTSTART:<xsl:value-of select="$start" />
33 DTEND:<xsl:value-of select="$end" />
34 SUMMARY:<xsl:value-of select="$title" /><xsl:if test="$short != ''"> -- <xsl:value-of select="$short" /></xsl:if>
35 DESCRIPTION:<xsl:value-of select="$abstract" />
36 END:VEVENT
37 </xsl:template>
38
39 </xsl:stylesheet>