a1b00a0bdbe0b93df73270ca6ae8d154d0f5b35b
[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:apply-templates select="newsitem" />
47         <xsl:apply-templates select="eventitem" />
48         </feed>
49 </xsl:template>
50
51 <xsl:template match="//eventitem">
52         <entry>
53         <title><xsl:value-of select="//short"/></title>
54         <link href="http://csclub.uwaterloo.ca"/>
55         <summary><xsl:value-of select="//abstract"/></summary>
56         </entry>
57 </xsl:template>
58
59 <xsl:template match="//newsitem">
60         <entry>
61         <link href="http://csclub.uwaterloo.ca"/>
62         <summary><xsl:value-of select="//newsitem"/></summary>
63         </entry>
64 </xsl:template>
65
66 </xsl:stylesheet>