cmcms: rss feeds now with guid for duplicate avoidance etc
[cmcms:cmcms.git] / rss20full.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3
4 cmcms == ClaudiusMaximus Content Management System
5 Copyright (C) 2008,2009  Claude Heiland-Allen <claudiusmaximus@goto10.org>
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Affero General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU Affero General Public License for more details.
16
17 You should have received a copy of the GNU Affero General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 -->
21 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
22 <xsl:output method="xml" indent="no" encoding="UTF-8" />
23 <xsl:param name="TITLE"/>
24 <xsl:param name="DESCRIPTION"/>
25 <xsl:param name="URL"/>
26 <xsl:template match="/">
27 <rss version="2.0">
28 <channel>
29 <title><xsl:value-of select="$TITLE" /></title>
30 <link><xsl:value-of select="$URL" /></link>
31 <description><xsl:value-of select="$DESCRIPTION" /></description>
32 <xsl:for-each select="pages/page[position() &lt;= 12]">
33 <item>
34 <title><xsl:value-of select="title" /></title>
35 <description><xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text><xsl:copy-of select="content/node()" /><xsl:text disable-output-escaping="yes">]]&gt;</xsl:text></description>
36 <link><xsl:value-of select="$URL" /><xsl:value-of select="file" />.html</link>
37 <guid><xsl:value-of select="$URL" /><xsl:value-of select="file" />.html</guid>
38 <pubDate><xsl:call-template name="date822"><xsl:with-param name="iso" select="date" /></xsl:call-template></pubDate>
39 <xsl:for-each select="tag">
40 <category><xsl:value-of select="." /></category>
41 </xsl:for-each>
42 </item>
43 </xsl:for-each>
44 </channel>
45 </rss>
46 </xsl:template>
47 <xsl:template name="date822"><xsl:param name="iso"/>
48 <xsl:variable name="year"  ><xsl:value-of select="substring($iso,1,4)"  /></xsl:variable>
49 <xsl:variable name="month" ><xsl:value-of select="substring($iso,6,2)"  /></xsl:variable>
50 <xsl:variable name="day"   ><xsl:value-of select="substring($iso,9,2)"  /></xsl:variable>
51 <xsl:variable name="hour"  ><xsl:value-of select="substring($iso,12,2)" /></xsl:variable>
52 <xsl:variable name="minute"><xsl:value-of select="substring($iso,15,2)" /></xsl:variable>
53 <xsl:variable name="second"><xsl:value-of select="substring($iso,18,2)" /></xsl:variable>
54 <xsl:variable name="zone"  ><xsl:value-of select="substring($iso,21,4)" /></xsl:variable>
55 <xsl:variable name="monstr"><xsl:value-of select="substring('JanFebMarAprMayJunJulAugSepOctNovDec',$month*3-2,3)" /></xsl:variable>
56 <xsl:variable name="zonstr">GMT</xsl:variable>
57 <xsl:value-of select="format-number($day,'00')"/><xsl:text> </xsl:text>
58 <xsl:value-of select="$monstr"/><xsl:text> </xsl:text>
59 <xsl:value-of select="$year"/><xsl:text> </xsl:text>
60 <xsl:value-of select="format-number($hour,'00')"/><xsl:text>:</xsl:text>
61 <xsl:value-of select="format-number($minute,'00')"/><xsl:text>:</xsl:text>
62 <xsl:value-of select="format-number($second,'00')"/><xsl:text> </xsl:text>
63 <xsl:value-of select="$zonstr" />
64 </xsl:template>
65 </xsl:stylesheet>