aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-12 23:48:07 +0200
committerAdrian Kummerlaender2014-09-12 23:48:07 +0200
commit9efc55061c81e26b70d11f6acf0c0a369d9a9031 (patch)
tree099c9209da1d4cd881bfc17abbfcd24ab0d03a1a
parent6600fc64fdc3573d4f99a18f7814c599d93711ba (diff)
downloadblog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar.gz
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar.bz2
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar.lz
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar.xz
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.tar.zst
blog.kummerlaender.eu-9efc55061c81e26b70d11f6acf0c0a369d9a9031.zip
Updated feed transformation to generate valid ATOM 1.0
* added base link * added namespace for whole stylesheet intead of in the feed node * added id to entry nodes * added closing slash to feed id url
-rw-r--r--source/99_result/atom.xsl32
1 files changed, 25 insertions, 7 deletions
diff --git a/source/99_result/atom.xsl b/source/99_result/atom.xsl
index 7d50f2d..8bc0286 100644
--- a/source/99_result/atom.xsl
+++ b/source/99_result/atom.xsl
@@ -1,6 +1,7 @@
<?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"
>
@@ -30,28 +31,45 @@
<xsl:copy/>
</xsl:template>
-<xsl:template match="/">
- <feed xmlns="http://www.w3.org/2005/Atom">
- <id><xsl:value-of select="$url"/></id>
- <title><xsl:value-of select="datasource/meta/title"/></title>
+<xsl:template match="datasource">
+ <feed>
+ <link href="{$url}/atom.xml" rel="self" />
+
+ <id>
+ <xsl:value-of select="concat($url, '/')"/>
+ </id>
+ <title>
+ <xsl:value-of select="meta/title"/>
+ </title>
<author>
<name>
<xsl:value-of select="$author"/>
</name>
</author>
+ <updated>
+ <xsl:value-of select="articles/entry[1]/date/full"/>
+ <xsl:text>T00:00:01+02:00</xsl:text>
+ </updated>
- <xsl:apply-templates select="datasource/articles/entry[position() &lt;= 5]"/>
+ <xsl:apply-templates select="articles/entry[position() &lt;= 5]"/>
</feed>
</xsl:template>
-<xsl:template match="datasource/articles/entry">
+<xsl:template match="articles/entry">
<entry xmlns="http://www.w3.org/2005/Atom">
+ <id>
+ <xsl:value-of select="$url"/>
+ <xsl:text>/article/</xsl:text>
+ <xsl:value-of select="@handle"/>
+ </id>
<title>
<xsl:value-of select="title"/>
</title>
<link>
<xsl:attribute name="href">
- <xsl:value-of select="$url"/>/article/<xsl:value-of select="@handle"/>
+ <xsl:value-of select="$url"/>
+ <xsl:text>/article/</xsl:text>
+ <xsl:value-of select="@handle"/>
</xsl:attribute>
</link>
<content type="xhtml">