Fix link in atom feeds
[mspang/www.git] / xsl / atom.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:fn="http://www.w3.org/2005/xpath-functions"
8     xmlns:csc="http://csclub.uwaterloo.ca/xslt">
9
10 <xsl:param name="g_date" required="yes" />
11 <xsl:param name="g_time" required="yes" />
12 <xsl:param name="g_pwd" required="yes" />
13 <xsl:param name="g_root" required="yes" />
14
15 <xsl:template match="//eventdefs">
16     <xsl:call-template name="atom">
17         <xsl:with-param name="title">Events</xsl:with-param>
18         <xsl:with-param name="feedfile">events.atom</xsl:with-param>
19         <xsl:with-param name="uuid">006f667f-ecae-483a-8cbc-f0c5084dccb1</xsl:with-param>
20     </xsl:call-template>
21 </xsl:template>
22
23 <xsl:template match="//newsdefs">
24     <xsl:call-template name="atom">
25         <xsl:with-param name="title">News</xsl:with-param>
26         <xsl:with-param name="feedfile">news.atom</xsl:with-param>
27         <xsl:with-param name="uuid">bdae3752-0cb7-4932-b176-019076389b54</xsl:with-param>
28     </xsl:call-template>
29 </xsl:template>
30
31 <xsl:template name="atom">
32     <xsl:param name="title"/>
33     <xsl:param name="feedfile"/>
34     <xsl:param name="uuid"/>
35     <feed xmlns="http://www.w3.org/2005/Atom">
36         <title>UW Computer Science Club <xsl:value-of select="$title"/></title>
37         <link href="http://csclub.uwaterloo.ca/{$feedfile}" rel="self"/>
38         <link href="http://csclub.uwaterloo.ca/"/>
39         <updated><xsl:value-of select="$g_date"/></updated>
40         <id>urn:uuid:<xsl:value-of select="$uuid"/></id>
41         <author>
42         <name>University of Waterloo Computer Science Club</name>
43         </author>
44         <xsl:for-each select="newsitem">
45             <entry>
46                 <link href="http://csclub.uwaterloo.ca"/>
47                 <summary><xsl:value-of select="."/></summary>
48                 <author><xsl:value-of select="@author"/></author>
49             </entry>
50         </xsl:for-each>
51         <xsl:for-each select="eventitem">
52             <entry>
53                 <title><xsl:value-of select="@title"/></title>
54                 <!-- we do a hack here with the translate to get whitespace replacement -->
55                 <link href="{concat('http://csclub.uwaterloo.ca/events/',translate(@room,' ','_'),'-',translate(@date,' ','_'),'-',translate(@time,' ','_'),'.html')}"/>
56                 <author><xsl:value-of select="short"/></author>
57                 <summary><xsl:value-of select="abstract"/></summary>
58             </entry>
59         </xsl:for-each>
60     </feed>
61 </xsl:template>
62
63 </xsl:stylesheet>