aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-07-26 23:33:26 +0200
committerAdrian Kummerlaender2014-07-26 23:33:26 +0200
commitadbe381a2de8b71ee7cb9ca7d383881314ec7847 (patch)
tree33ec091717d006de5615e705c83a772127e95f8e /source
parentcff2b8fe9a763752e0f871cad09dee6ed86da1ea (diff)
downloadblog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar.gz
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar.bz2
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar.lz
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar.xz
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.tar.zst
blog.kummerlaender.eu-adbe381a2de8b71ee7cb9ca7d383881314ec7847.zip
Implemented articles meta datasource grouped by year
Diffstat (limited to 'source')
-rw-r--r--source/03_meta/articles.xsl48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/03_meta/articles.xsl b/source/03_meta/articles.xsl
new file mode 100644
index 0000000..e1b4a82
--- /dev/null
+++ b/source/03_meta/articles.xsl
@@ -0,0 +1,48 @@
+<?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:include href="[utility/datasource.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="target/02_data/articles.xml" target="articles"/>
+ <target mode="plain" value="articles.xml"/>
+</xsl:variable>
+
+<xsl:key name="years" match="datasource/articles/entry/date/year/text()" use="." />
+
+<xsl:template match="articles">
+ <xsl:for-each select="entry/date/year/text()[generate-id() = generate-id(key('years',.)[1])]">
+ <year handle="{.}">
+ <xsl:call-template name="get_articles">
+ <xsl:with-param name="year" select="."/>
+ </xsl:call-template>
+ </year>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="get_articles">
+ <xsl:param name="year"/>
+
+ <xsl:for-each select="/datasource/articles/entry[date/year = $year]">
+ <article handle="{@handle}">
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+ <date>
+ <xsl:value-of select="date/full"/>
+ </date>
+ </article>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>