2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:rss="http://purl.org/rss/1.0/"
4 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
5 xmlns:cvsf="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS"
6 xmlns:cvs="http://nwalsh.com/rdf/cvs#"
7 xmlns:dc="http://purl.org/dc/elements/1.1/"
8 exclude-result-prefixes="rss rdf cvs dc cvsf"
11 <xsl:output method="html"/>
13 <xsl:template match="rss">
14 <xsl:variable name="rss" select="document(@feed, .)"/>
18 <xsl:when test="not($rss)">
19 <xsl:message>RSS Failed: <xsl:value-of select="@feed"/></xsl:message>
20 <xsl:text>[RSS Failed: </xsl:text>
21 <xsl:value-of select="@feed"/>
23 <xsl:when test="$rss/rdf:RDF">
24 <xsl:apply-templates select="$rss/*/rss:channel"/>
27 <!-- is there an otherwise case? -->
28 <xsl:apply-templates select="$rss//rss:channel"/>
34 <xsl:template match="rss:channel">
35 <xsl:variable name="image-resource" select="rss:image/@rdf:resource"/>
36 <xsl:variable name="image" select="//rss:image[@rdf:about = $image-resource]"/>
38 <xsl:if test="$image">
40 <xsl:when test="$image/rss:link">
41 <a href="{$image/rss:link}">
42 <img src="{$image/rss:url}" alt="{$image/rss:title}" align="right" border="0"/>
46 <img src="{$image/rss:url}" alt="{$image/rss:title}" align="right"/>
51 <xsl:apply-templates select="rss:title"/>
52 <xsl:apply-templates select="rss:description"/>
53 <xsl:apply-templates select="rss:items"/>
55 <xsl:if test="$image">
60 <xsl:template match="rss:title">
61 <xsl:param name="wrapper" select="'h3'"/>
63 <xsl:element name="{$wrapper}">
65 <xsl:when test="../rss:link">
66 <a href="{../rss:link[1]}">
67 <xsl:apply-templates/>
71 <xsl:apply-templates/>
75 <xsl:if test="../dc:date|../cvs:date">
77 <xsl:when test="../dc:date">
78 <xsl:text> (</xsl:text>
79 <xsl:value-of select="../dc:date[1]"/>
80 <xsl:text>)</xsl:text>
82 <xsl:when test="function-available('cvsf:localTime')">
83 <xsl:variable name="timeString" select="cvsf:localTime(../cvs:date[1])"/>
84 <xsl:text> (</xsl:text>
85 <xsl:value-of select="substring($timeString, 1, 3)"/>
86 <xsl:text>, </xsl:text>
87 <xsl:value-of select="substring($timeString, 9, 2)"/>
88 <xsl:text> </xsl:text>
89 <xsl:value-of select="substring($timeString, 5, 3)"/>
90 <xsl:text> </xsl:text>
91 <xsl:value-of select="substring($timeString, 25, 4)"/>
92 <xsl:text>)</xsl:text>
95 <xsl:value-of select="../cvs:date[1]"/>
102 <xsl:template match="rss:description">
104 <xsl:apply-templates/>
108 <xsl:template match="rss:items">
110 <xsl:for-each select="rdf:Seq/rdf:li[@rdf:resource and @rdf:resource != '']">
111 <xsl:variable name="resource" select="@rdf:resource"/>
112 <xsl:variable name="item" select="//rss:item[@rdf:about = $resource]"/>
113 <xsl:if test="not($item)">
115 <xsl:text>RSS Warning: there is no item labelled: </xsl:text>
116 <xsl:value-of select="$resource"/>
119 <xsl:if test="count($item) > 1">
121 <xsl:text>RSS Warning: there is more than one item labelled: </xsl:text>
122 <xsl:value-of select="$resource"/>
125 <xsl:apply-templates select="$item"/>
130 <xsl:template match="rss:item">
131 <xsl:message>RSS item: <xsl:value-of select="rss:title"/></xsl:message>
133 <xsl:apply-templates select="rss:title">
134 <xsl:with-param name="wrapper" select="'dt'"/>
135 </xsl:apply-templates>
136 <xsl:if test="rss:description">
138 <xsl:apply-templates select="rss:description"/>