ATOM-Feed: Reperatur & Aufräumung

git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@504 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
astro 2006-08-03 14:26:23 +00:00
parent 4a90f239a1
commit e6c629eeb4
2 changed files with 27 additions and 17 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/2005/Atom"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:crypto="http://exslt.org/crypto"
@ -15,21 +16,24 @@
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
<xsl:template match="news">
<xsl:element name="feed">
<xsl:attribute name="xmlns">http://www.w3.org/2005/Atom</xsl:attribute>
<xsl:attribute name="xml:lang">de</xsl:attribute>
<feed xml:lang="de">
<!-- Datum des neuesten item für /feed/updated holen -->
<xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:if test="position() = 1">
<updated><xsl:value-of select="document(.)/item/@date"/>Z</updated>
</xsl:if>
</xsl:for-each>
<!-- Allgemeines -->
<title>www.c3d2.de Newsfeed</title>
<link rel="self" href="https://www.c3d2.de/news-atom.xml" />
<id>http://www.c3d2.de/</id>
<description>Neues aus dem Chaos Computer Club Dresden</description>
<language>de-de</language>
<!-- XXX
<pubDate><xsl:value-of select="news/item/@date"/></pubDate>
-->
<subtitle>Neues aus dem Chaos Computer Club Dresden</subtitle>
<!-- Alle item zu atom-entry umformen -->
<xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/@date)" data-type="number" order="descending" />
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:if test="position() &lt;= 10">
<xsl:variable name="newsfile" select="."/>
@ -41,23 +45,28 @@
</xsl:if>
</xsl:for-each>
</xsl:element>
</feed>
</xsl:template>
<xsl:template name="atom-entry">
<xsl:param name="newsfile"/>
<entry>
<id><xsl:value-of select="crypto:sha1(concat(@title,@date))"/></id>
<xsl:variable name="href">
<xsl:value-of select="$baseurl"/>
<xsl:value-of select="substring-before(substring-after($newsfile, 'content/'), '.xml')"/>
<xsl:text>.html</xsl:text>
</xsl:variable>
<id><xsl:value-of select="$href"/></id>
<title><xsl:value-of select="@title"/></title>
<link href="{$baseurl}{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html"/>
<updated><xsl:value-of select="@date"/></updated>
<link href="{$href}"/>
<updated><xsl:value-of select="@date"/>Z</updated>
<author>
<name><xsl:value-of select="@author"/></name>
</author>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<content type="html">
<!--div xmlns="http://www.w3.org/1999/xhtml"-->
<xsl:apply-templates/>
</div>
<!--/div-->
</content>
<xsl:for-each select="resource">
<link
@ -70,7 +79,7 @@
</entry>
</xsl:template>
<xsl:template match="item/image">
<xsl:template match="item/image" xmlns="http://www.w3.org/1999/xhtml">
<img>
<xsl:choose>
<xsl:when test="contains(., '://')">

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rss="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"