You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/08/24 19:52:03 UTC
cvs commit: cocoon-2.1/src/blocks/linotype/samples/stylesheets news2rss-2.0.xslt
stefano 2003/08/24 10:52:03
Modified: src/blocks/linotype/samples/stylesheets news2rss-2.0.xslt
Log:
fixed validation problems with RSS2 and allowed escaped markup in <description> which is rendered correctly by news aggregators such as NetNewsWire. The images link are still broken though, will fix this when it bugs me enough.
Revision Changes Path
1.3 +18 -6 cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2rss-2.0.xslt
Index: news2rss-2.0.xslt
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2rss-2.0.xslt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- news2rss-2.0.xslt 26 Jun 2003 03:09:49 -0000 1.2
+++ news2rss-2.0.xslt 24 Aug 2003 17:52:03 -0000 1.3
@@ -4,6 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n="http://www.betaversion.org/linotype/news/1.0"
xmlns:h="http://www.w3.org/1999/xhtml"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<xsl:param name="home"/>
@@ -11,12 +12,12 @@
<xsl:template match="/">
<rss version="2.0">
- <channel>
+ <channel>
<title>Stefano's Linotype</title>
<link>http://www.betaversion.org/~stefano/linotype/</link>
<description>Stefano Mazzocchi's weblog</description>
- <language>en</language>
- <copyright>Copyright 2003 Stefano Mazzocchi. Some rights reserved.</copyright>
+ <dc:creator>Stefano Mazzocchi</dc:creator>
+ <dc:rights>Copyright 2003 Stefano Mazzocchi. Some rights reserved.</dc:rights>
<lastBuildDate><xsl:value-of select="(//n:news[@online = 'on'])[1]/@creation-fulldate"/></lastBuildDate>
<generator>Linotype 1.1</generator>
<xsl:apply-templates select="(//n:news[@online = 'on'])[position() < number($count)]"/>
@@ -27,11 +28,22 @@
<xsl:template match="n:news">
<item>
<title><xsl:value-of select="n:title"/></title>
- <link><xsl:value-of select="$home"/>/<xsl:value-of select="../@id"/>/</link>
- <description><xsl:apply-templates select="h:body"/></description>
- <pubDate><xsl:value-of select="@creation-fulldate"/></pubDate>
+ <link><xsl:value-of select="$home"/>/<xsl:value-of select="../@id"/>/</link>
+ <description><xsl:apply-templates select="h:body/node()" mode="encode"/></description>
+ <xsl:apply-templates select="h:body"/>
+ <dc:date><xsl:value-of select="@creation-fulldate"/></dc:date>
</item>
</xsl:template>
+
+ <xsl:template match="*" mode="encode">
+ <xsl:text><</xsl:text><xsl:value-of select="name()"/><xsl:apply-templates select="@*" mode="encode"/><xsl:text>></xsl:text>
+ <xsl:apply-templates select="node()" mode="encode"/>
+ <xsl:text></</xsl:text><xsl:value-of select="name()"/><xsl:text>></xsl:text>
+ </xsl:template>
+
+<xsl:template match="@*" mode="encode"><xsl:text> </xsl:text><xsl:value-of select="name()"/><xsl:text>="</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text></xsl:template>
+
+ <xsl:template match="text()" mode="encode"><xsl:value-of select="."/></xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>