Fixed translation of event URLs to strip single quote. This, in turn, fixed generatio...
[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="title" select="csc:ical-escape(@title)" />
24 <xsl:variable name="short" select="csc:ical-escape(string(short))"  />
25 <xsl:variable name="abstract" select="csc:ical-escape(string(abstract))" />
26 BEGIN:VEVENT
27 LOCATION:University of Waterloo - <xsl:value-of select="$room" />
28 DTSTAMP:20060912T200708Z
29 UID:<xsl:value-of select="$start" />@csclub.uwaterloo.ca
30 SEQUENCE:11
31 DTSTART:<xsl:value-of select="$start" />
32 <xsl:choose>
33   <xsl:when test="(string(@edate) != '') and (string(@etime) != '')">
34     <xsl:variable name="end" select="csc:ical-datetime(@edate, @etime)" />
35 DTEND:<xsl:value-of select="$end" />
36   </xsl:when>
37   <xsl:when test="string(@etime) != ''">
38     <xsl:variable name="end" select="csc:ical-datetime(@date, @etime)" />
39 DTEND:<xsl:value-of select="$end" />
40   </xsl:when>
41   <xsl:otherwise>
42     <xsl:variable name="end" select="csc:ical-datetime(@date, @time, 60)" />
43 DTEND:<xsl:value-of select="$end" />
44   </xsl:otherwise>
45 </xsl:choose>
46 SUMMARY:<xsl:value-of select="$title" />
47 DESCRIPTION:<xsl:if test="$short != ''"><xsl:value-of select="$short" /></xsl:if><xsl:if test="$short = ''"><xsl:value-of select="$abstract" /></xsl:if>
48 END:VEVENT
49 </xsl:template>
50
51 </xsl:stylesheet>