aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-07-28 21:00:59 +0200
committerAdrian Kummerlaender2014-07-28 21:00:59 +0200
commitbd328048e195c764bf9be5266605975dff73e387 (patch)
treec958822d4d823ccb7230bc50eb5070a24d0a476d
parenta6c539589757b24e53d53ae07ab5bf6753e60f81 (diff)
downloadblog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar.gz
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar.bz2
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar.lz
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar.xz
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.tar.zst
blog.kummerlaender.eu-bd328048e195c764bf9be5266605975dff73e387.zip
Implemented basic atom feed transformation
* atom was choosen in favor of RSS mainly because it is not easily possible to generate the required RSS timestamp in xalan-c (day of the week required) * modified master template accordingly
-rw-r--r--source/99_result/atom.xsl50
-rw-r--r--utility/master.xsl4
2 files changed, 52 insertions, 2 deletions
diff --git a/source/99_result/atom.xsl b/source/99_result/atom.xsl
new file mode 100644
index 0000000..86f0217
--- /dev/null
+++ b/source/99_result/atom.xsl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="no"
+ encoding="UTF-8"
+ indent="yes"
+/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="target/02_data/articles.xml" target="articles"/>
+ <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="meta"/>
+ <target mode="plain" value="atom.xml"/>
+</xsl:variable>
+
+<xsl:variable name="url" select="datasource/meta/url"/>
+
+<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>
+ <author>
+ <name>Adrian Kummerländer</name>
+ </author>
+
+ <xsl:apply-templates select="datasource/articles/entry"/>
+ </feed>
+</xsl:template>
+
+<xsl:template match="datasource/articles/entry">
+ <entry>
+ <title><xsl:value-of select="title"/></title>
+ <link><xsl:value-of select="$url"/>/article/<xsl:value-of select="@handle"/></link>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <xsl:copy-of select="content/node()"/>
+ </div>
+ </content>
+ <published>
+ <xsl:value-of select="date/full"/>
+ <xsl:text>T00:00:01+02:00</xsl:text>
+ </published>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/master.xsl b/utility/master.xsl
index 698aed5..cda2575 100644
--- a/utility/master.xsl
+++ b/utility/master.xsl
@@ -51,7 +51,7 @@
<li><a href="{$url}/archive">Archive</a></li>
<li><a href="{$url}/projects">Projects</a></li>
<li><a href="{$url}/page/contact">Contact</a></li>
- <li class="last_item"><a href="{$url}/rss">RSS</a></li>
+ <li class="last_item"><a href="{$url}/atom.xml">Feed</a></li>
</ul>
</div>
<div id="main">
@@ -67,7 +67,7 @@
<a href="https://github.com/KnairdA/InputXSLT">Made with XSLT</a>
<ul>
<li><a href="{$url}/page/contact">Contact</a></li>
- <li class="last_item"><a href="{$url}/rss">RSS</a></li>
+ <li class="last_item"><a href="{$url}/atom.xml">Feed</a></li>
</ul>
</div>
</div>