Made atom feeds happy
[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="uuid">006f667f-ecae-483a-8cbc-f0c5084dccb1</xsl:with-param>  
19 </xsl:call-template>
20 </xsl:template>
21
22 <xsl:template match="//newsdefs">
23 <xsl:call-template name="atom">
24 <xsl:with-param name="title">News</xsl:with-param>
25 <xsl:with-param name="uuid">bdae3752-0cb7-4932-b176-019076389b54</xsl:with-param>  
26 </xsl:call-template>
27 </xsl:template>
28
29 <xsl:template name="atom">
30 <xsl:param name="title"/>
31 <xsl:param name="uuid"/>
32 <xsl:result-document method="xml" encoding="UTF-8" 
33       href="{concat($g_root, '/', $title, '.atom')}">
34 </xsl:result-document>
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/{$title}.atom" rel="self"/>
38         <link href="http://csclub.uwaterloo.ca/"/>
39         <updated><xsl:value-of select="$g_date"/></updated>
40         <id>
41         urn:uuid:<xsl:value-of select="$uuid"/>
42         </id>
43         <author>
44         <name>University of Waterloo Computer Science Club</name>
45         </author>
46         <xsl:for-each select="newsitem">
47                 <entry>
48                 <link href="http://csclub.uwaterloo.ca"/>
49                 <summary><xsl:value-of select="."/></summary>
50                 <author><xsl:value-of select="@author"/></author>
51                 </entry>
52         </xsl:for-each>
53         <xsl:for-each select="eventitem">
54                 <entry>
55                 <title><xsl:value-of select="short"/></title>
56                 <link href="http://csclub.uwaterloo.ca"/>
57                 <summary><xsl:value-of select="abstract"/></summary>
58                 </entry>
59         </xsl:for-each>
60         </feed>
61 </xsl:template>
62
63 </xsl:stylesheet>