Added title to information section of event pages.
[mspang/www.git] / xsl / events.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="2.0"
4     xmlns="http://www.w3.org/1999/xhtml"
5     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6     xmlns:xs="http://www.w3.org/2001/XMLSchema"
7     xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
8
9 <xsl:template name="events">
10   <tr>
11     <th colspan="2" class="news">Upcoming Events</th>
12   </tr>
13   <xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
14     <xsl:sort select="translate(@date, '-', '')" 
15         order="ascending" data-type="number" />
16     <xsl:if test="translate(@date, '-', '') &gt;= translate($g_date, '-', '')">
17       <tr>
18         <td class="eventdate"><xsl:value-of select="@date" /></td>
19         <td rowspan="2" valign="top" class="eventitem"> 
20           <a href="{translate(concat('/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
21             <xsl:value-of select="@title" />
22           </a>.
23           <xsl:value-of select="short" />
24         </td>
25       </tr>
26       <tr>
27         <td class="eventroom">
28           <xsl:value-of select="@time" />,
29           <xsl:value-of select="@room" />
30         </td>
31       </tr>
32     </xsl:if>
33   </xsl:for-each>
34   <tr>
35     <td class="eventitem" colspan="2">
36       <a href="events/">Past events</a> are available.
37     </td>
38   </tr>
39 </xsl:template>
40
41 <xsl:template match="events-this-term">
42   <xsl:call-template name="events-by-term">
43     <xsl:with-param name="date" select="$g_date" />
44   </xsl:call-template>
45 </xsl:template>
46
47 <xsl:template name="events-by-term">
48   <xsl:param name="date" />
49   <p>The events for <xsl:value-of select="csc:term($date)" /> are listed here.
50     You can also <a href="{$pre}events.ics">download an ICS</a> of them.</p>
51   <xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
52     <xsl:sort select="translate(@date, '-', '')" 
53         order="ascending" data-type="number" />
54     <xsl:if test="csc:term(@date) = csc:term($date)">
55       <h3><a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}"><xsl:value-of select="@title" /></a></h3>
56       <p>
57         <strong>
58           <xsl:value-of select="@room" />, 
59           <xsl:value-of select="@date" />, 
60           <xsl:value-of select="@time" />:
61         </strong>
62         <xsl:value-of select="short" />.
63       </p>
64     </xsl:if>
65   </xsl:for-each>
66 </xsl:template>
67
68 <xsl:template match="eventdefs">
69   <xsl:apply-templates/>
70 </xsl:template>
71
72 <xsl:template match="eventitem">
73   <xsl:result-document method="xml" encoding="ISO-8859-1" 
74       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
75       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
76       href="{translate(concat($g_root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
77     <html>
78       <head>
79         <title><xsl:value-of select="@title" /></title>
80         <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
81       </head>
82       <body><div>
83         <xsl:call-template name="header" />
84         <h2>Information</h2>
85         <div>
86           <p><xsl:value-of select="@title" />.</p>
87           <p>
88             Held in <xsl:value-of select="@room" />, on
89             <xsl:value-of select="@date" />, at 
90             <xsl:value-of select="@time" />.
91           </p>
92         </div>
93         <h2>Abstract</h2>
94         <xsl:apply-templates select="abstract/node()" />
95         <xsl:call-template name="footer" />
96       </div></body>
97     </html>
98   </xsl:result-document>
99 </xsl:template>
100
101 <xsl:template match="generate-event-files">
102   <xsl:apply-templates select="document(concat($g_root, '/events.xml'))/eventdefs" />
103 </xsl:template>
104
105 <xsl:template match="old-events">
106   <xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
107     <xsl:sort select="translate(@date, '-', '')" 
108         order="descending" data-type="number" />
109     <xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($g_date))">
110       <p><a href="{translate(concat('old-',csc:term(@date), '.html'), ' ', '_')}">
111         <xsl:value-of select="csc:term(@date)" />
112       </a></p>
113       <xsl:result-document method="xml" encoding="ISO-8859-1" 
114             doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
115             doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
116             href="{translate(concat($g_root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
117         <html>
118           <head>
119             <title>Events for <xsl:value-of select="csc:term(@date)" /></title>
120             <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
121           </head>
122           <body><div>
123             <xsl:call-template name="header" />
124             <xsl:call-template name="events-by-term">
125                 <xsl:with-param name="date" select="@date" />
126             </xsl:call-template>
127             <xsl:call-template name="footer" />
128           </div></body>
129         </html>
130       </xsl:result-document>
131     </xsl:if>
132   </xsl:for-each>
133 </xsl:template>
134
135 </xsl:stylesheet>