Add support for generating an RSS 2.0 feed for the security advisories

in addition to the current RDF/RSS 0.9 feed.
This commit is contained in:
Murray Stokely 2008-01-10 04:23:39 +00:00
parent 026c28085f
commit 86e8306178
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=31241
3 changed files with 105 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# $FreeBSD: www/en/security/Makefile,v 1.13 2004/05/25 01:19:50 hrs Exp $
# $FreeBSD: www/en/security/Makefile,v 1.14 2005/09/18 04:33:46 hrs Exp $
.if exists(../Makefile.conf)
.include "../Makefile.conf"
@ -22,5 +22,6 @@ NO_DATA.advisories= yes
NO_TIDY.advisories= yes
XMLDOCS+= advisories-rdf:security-rdf.xsl::advisories.rdf
XMLDOCS+= advisories-rss:security-rss.xsl::rss.xml
.include "${WEB_PREFIX}/share/mk/web.site.mk"

View file

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet PUBLIC "-//FreeBSD//DTD FreeBSD XSLT 1.0 DTD//EN"
"http://www.FreeBSD.org/XML/www/share/sgml/xslt10-freebsd.dtd" [
<!ENTITY base ".">
<!ENTITY title "">
]>
<!-- $FreeBSD$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
exclude-result-prefixes="cvs">
<xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="date">
<xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
</xsl:variable>
<xsl:template match="/">
<xsl:call-template name="rss-security-advisories">
<xsl:with-param name="advisories.xml" select="$advisories.xml" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xsl:stylesheet PUBLIC "-//FreeBSD//DTD FreeBSD XSLT 1.0 DTD//EN"
"http://www.FreeBSD.org/XML/www/share/sgml/xslt10-freebsd.dtd">
<!-- $FreeBSD: www/share/sgml/libcommon.xsl,v 1.9 2008/01/04 22:28:53 jkois Exp $ -->
<!-- $FreeBSD: www/share/sgml/libcommon.xsl,v 1.10 2008/01/07 07:39:35 murray Exp $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
@ -55,6 +55,10 @@
rdf-security-advisories-title security/security-rdf.xsl (for l10n)
rdf-security-advisories-items security/security-rdf.xsl
rss-security-advisories security/security-rss.xsl
rss-security-advisories-title security/security-rss.xsl (for l10n)
rss-security-advisories-items security/security-rss.xsl
html-index-advisories-items index.xsl
html-index-advisories-items-lastmodified index.xsl (for i10n)
html-index-news-project-items index.xsl
@ -918,6 +922,78 @@
</xsl:for-each>
</xsl:template>
<!-- template: "rss-security-advisories"
generate a rdf of 10 most recent security advisories -->
<xsl:template name="rss-security-advisories">
<xsl:param name="advisories.xml" select="''" />
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<xsl:call-template name="rss-security-advisories-title">
<xsl:with-param name="advisories.xml" select="$advisories.xml" />
</xsl:call-template>
<xsl:call-template name="rss-security-advisories-items">
<xsl:with-param name="advisories.xml" select="$advisories.xml" />
</xsl:call-template>
</channel>
</rss>
</xsl:template>
<!-- template: "rss-security-advisories-title"
pulls in the 10 most recent security advisories -->
<xsl:template name="rss-security-advisories-title"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:param name="advisories.xml" select="''" />
<xsl:variable name="title">FreeBSD Security Advisories</xsl:variable>
<xsl:variable name="link">http://www.FreeBSD.org/security/</xsl:variable>
<title><xsl:value-of select="$title" /></title>
<link><xsl:value-of select="$link" /></link>
<description>Security advisories published from the FreeBSD Project</description>
<language>en-us</language>
<webMaster>secteam@FreeBSD.org (FreeBSD Security Team)</webMaster>
<managingEditor>secteam@FreeBSD.org (FreeBSD Security Team)</managingEditor>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<ttl>120</ttl>
<image>
<url>http://www.FreeBSD.org/logo/logo-full.png</url>
<title><xsl:value-of select="$title" /></title>
<link><xsl:value-of select="$link" /></link>
</image>
<atom:link rel="self" type="application/rss+xml">
<xsl:attribute name="href">
<xsl:value-of select="$link" /><xsl:text>rss.xml</xsl:text>
</xsl:attribute>
</atom:link>
</xsl:template>
<!-- template: "rss-security-advisories-items"
pulls in the 10 most recent security advisories -->
<xsl:template name="rss-security-advisories-items"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:param name="advisories.xml" select="''" />
<xsl:for-each select="document($advisories.xml)/descendant::advisory[position() &lt;= 10]">
<item>
<title><xsl:value-of select="name"/></title>
<xsl:choose>
<xsl:when test="@omithref = 'yes'">
<xsl:value-of select="name"/>
</xsl:when>
<xsl:otherwise>
<link><xsl:value-of select="concat('&ftpbase;', name, '.asc')" /></link>
<guid><xsl:value-of select="concat('&ftpbase;', name, '.asc')" /></guid>
</xsl:otherwise>
</xsl:choose>
</item>
</xsl:for-each>
</xsl:template>
<!-- template: "html-index-news-project-items"
pulls in the 5 most recent project items -->