Added atom feed generation.

This commit is contained in:
David Tenty 2007-09-21 21:02:46 -04:00
parent 2e2329ec44
commit 4cbbaad576
3 changed files with 72 additions and 1 deletions

View File

@ -1,7 +1,7 @@
INPUTS = index.xml
SUBDIRS = about events office news services media
first: noroot events.ics members.xml all
first: noroot events.ics members.xml events.atom news.atom all
find ! -regex '.*/\..*' -type f ! -perm -0664 -print0 | xargs -r0 chmod u=rwX,g=rwX,o=rX || true
find ! -regex '.*/\..*' -type d ! -perm 2775 -print0 | xargs -r0 chmod 2775 || true
find ! -regex '.*/\..*' -type d ! -group www -print0 | xargs -r0 chgrp www || true
@ -20,6 +20,10 @@ events.ics:
include default.mk
%.atom: %.xml
java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@ $< $(ROOT)/xsl/atom.xsl $(XSLTARGS)
sed -i 's| xmlns=""||' $@
default.mk: default.mk.in
echo 'ROOT = '`pwd` > $@
cat $< >> $@

View File

@ -1,3 +1,4 @@
<?xml version='1.0'?>
<eventdefs>

66
xsl/atom.xsl Normal file
View File

@ -0,0 +1,66 @@
<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:csc="http://csclub.uwaterloo.ca/xslt">
<xsl:param name="g_date" required="yes" />
<xsl:param name="g_time" required="yes" />
<xsl:param name="g_pwd" required="yes" />
<xsl:param name="g_root" required="yes" />
<xsl:template match="//eventdefs">
<xsl:call-template name="atom">
<xsl:with-param name="title">Events</xsl:with-param>
<xsl:with-param name="uuid">006f667f-ecae-483a-8cbc-f0c5084dccb1</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="//newsdefs">
<xsl:call-template name="atom">
<xsl:with-param name="title">News</xsl:with-param>
<xsl:with-param name="uuid">bdae3752-0cb7-4932-b176-019076389b54</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="atom">
<xsl:param name="title"/>
<xsl:param name="uuid"/>
<xsl:result-document method="xml" encoding="UTF-8"
href="{concat($g_root, '/', $title, '.atom')}">
</xsl:result-document>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>UW Computer Science Club <xsl:value-of select="$title"/></title>
<link href="http://csclub.uwaterloo.ca/{$title}.atom" rel="self"/>
<link href="http://csclub.uwaterloo.ca/"/>
<updated><xsl:value-of select="$g_date"/></updated>
<id>
urn:uuid:<xsl:value-of select="$uuid"/>
</id>
<author>
<name>University of Waterloo Computer Science Club</name>
</author>
<xsl:apply-templates select="newsitem" />
<xsl:apply-templates select="eventitem" />
</feed>
</xsl:template>
<xsl:template match="//eventitem">
<entry>
<title><xsl:value-of select="//short"/></title>
<link href="http://csclub.uwaterloo.ca"/>
<summary><xsl:value-of select="//abstract"/></summary>
</entry>
</xsl:template>
<xsl:template match="//newsitem">
<entry>
<link href="http://csclub.uwaterloo.ca"/>
<summary><xsl:value-of select="//newsitem"/></summary>
</entry>
</xsl:template>
</xsl:stylesheet>