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:
parent
4a90f239a1
commit
e6c629eeb4
43
xsl/atom.xsl
43
xsl/atom.xsl
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
|
xmlns="http://www.w3.org/2005/Atom"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:date="http://exslt.org/dates-and-times"
|
xmlns:date="http://exslt.org/dates-and-times"
|
||||||
xmlns:crypto="http://exslt.org/crypto"
|
xmlns:crypto="http://exslt.org/crypto"
|
||||||
|
@ -15,21 +16,24 @@
|
||||||
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
|
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
|
||||||
|
|
||||||
<xsl:template match="news">
|
<xsl:template match="news">
|
||||||
<xsl:element name="feed">
|
<feed xml:lang="de">
|
||||||
<xsl:attribute name="xmlns">http://www.w3.org/2005/Atom</xsl:attribute>
|
<!-- Datum des neuesten item für /feed/updated holen -->
|
||||||
<xsl:attribute name="xml:lang">de</xsl:attribute>
|
<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>
|
<title>www.c3d2.de Newsfeed</title>
|
||||||
<link rel="self" href="https://www.c3d2.de/news-atom.xml" />
|
<link rel="self" href="https://www.c3d2.de/news-atom.xml" />
|
||||||
<id>http://www.c3d2.de/</id>
|
<id>http://www.c3d2.de/</id>
|
||||||
<description>Neues aus dem Chaos Computer Club Dresden</description>
|
<subtitle>Neues aus dem Chaos Computer Club Dresden</subtitle>
|
||||||
<language>de-de</language>
|
|
||||||
<!-- XXX
|
|
||||||
<pubDate><xsl:value-of select="news/item/@date"/></pubDate>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
<!-- Alle item zu atom-entry umformen -->
|
||||||
<xsl:for-each select="newsfile">
|
<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() <= 10">
|
<xsl:if test="position() <= 10">
|
||||||
<xsl:variable name="newsfile" select="."/>
|
<xsl:variable name="newsfile" select="."/>
|
||||||
|
|
||||||
|
@ -41,23 +45,28 @@
|
||||||
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:element>
|
</feed>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="atom-entry">
|
<xsl:template name="atom-entry">
|
||||||
<xsl:param name="newsfile"/>
|
<xsl:param name="newsfile"/>
|
||||||
<entry>
|
<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>
|
<title><xsl:value-of select="@title"/></title>
|
||||||
<link href="{$baseurl}{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html"/>
|
<link href="{$href}"/>
|
||||||
<updated><xsl:value-of select="@date"/></updated>
|
<updated><xsl:value-of select="@date"/>Z</updated>
|
||||||
<author>
|
<author>
|
||||||
<name><xsl:value-of select="@author"/></name>
|
<name><xsl:value-of select="@author"/></name>
|
||||||
</author>
|
</author>
|
||||||
<content type="xhtml">
|
<content type="html">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
<!--div xmlns="http://www.w3.org/1999/xhtml"-->
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</div>
|
<!--/div-->
|
||||||
</content>
|
</content>
|
||||||
<xsl:for-each select="resource">
|
<xsl:for-each select="resource">
|
||||||
<link
|
<link
|
||||||
|
@ -70,7 +79,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item/image">
|
<xsl:template match="item/image" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<img>
|
<img>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="contains(., '://')">
|
<xsl:when test="contains(., '://')">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:rss="http://purl.org/rss/1.0/"
|
xmlns:rss="http://purl.org/rss/1.0/"
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user