aboutsummaryrefslogtreecommitdiff
path: root/source/99_result
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-12-09 19:03:28 +0100
committerAdrian Kummerlaender2014-12-09 19:03:28 +0100
commit299dbbb58f9b6c6c85563bba4d1e43ae514a7949 (patch)
tree30a77680fb5d015648c1be639312cfb8f2a9bcfe /source/99_result
parent1b9a49bacf15c72c093b7e6de79b408c28e5b904 (diff)
downloadblog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar.gz
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar.bz2
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar.lz
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar.xz
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.tar.zst
blog.kummerlaender.eu-299dbbb58f9b6c6c85563bba4d1e43ae514a7949.zip
Replaced function-like data resolution with template applications
* e.g. article and tag support data is now fetched through direct _XPath_ template applications ** this required the introduction of a special `resolve` mode to prevent interaction between support and main content resolution ** in most cases arguments had to be wrapped inside helper constants to enable selection of e.g. article support data via the `@handle` attribute using the current elements `@handle` attribute * analogously to the recent changes in _StaticXSLT_ this commit aims to improve the XSLT code style used in generating this static website
Diffstat (limited to 'source/99_result')
-rw-r--r--source/99_result/archive.xsl2
-rw-r--r--source/99_result/article/article.xsl2
-rw-r--r--source/99_result/atom.xsl2
-rw-r--r--source/99_result/stream.xsl28
4 files changed, 14 insertions, 20 deletions
diff --git a/source/99_result/archive.xsl b/source/99_result/archive.xsl
index 31d8354..8ef7d9a 100644
--- a/source/99_result/archive.xsl
+++ b/source/99_result/archive.xsl
@@ -11,7 +11,7 @@
<datasource type="main" mode="full" source="02_meta/articles.xml" target="articles"/>
<datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
<datasource type="support" mode="full" source="00_content/microblog.xml" target="microblog"/>
- <target mode="plain" value="archive/index.html"/>
+ <target mode="plain" value="archive/index.html"/>
</xsl:variable>
<xsl:template name="title-text">Archive</xsl:template>
diff --git a/source/99_result/article/article.xsl b/source/99_result/article/article.xsl
index 37e2fda..d34df77 100644
--- a/source/99_result/article/article.xsl
+++ b/source/99_result/article/article.xsl
@@ -31,7 +31,7 @@
<xsl:call-template name="format-date">
<xsl:with-param name="date" select="date/full"/>
<xsl:with-param name="format" select="'M x, Y'"/>
- </xsl:call-template>
+ </xsl:call-template>
<xsl:text> | </xsl:text>
<xsl:for-each select="tags/tag">
<a href="/tag/{.}">
diff --git a/source/99_result/atom.xsl b/source/99_result/atom.xsl
index b5fffdd..4972bb8 100644
--- a/source/99_result/atom.xsl
+++ b/source/99_result/atom.xsl
@@ -17,7 +17,7 @@
<xsl:variable name="meta">
<datasource type="main" mode="full" source="01_data/articles.xml" target="articles"/>
<datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
- <target mode="plain" value="atom.xml"/>
+ <target mode="plain" value="atom.xml"/>
</xsl:variable>
<xsl:variable name="url" select="datasource/meta/url"/>
diff --git a/source/99_result/stream.xsl b/source/99_result/stream.xsl
index 5d2218c..d71b094 100644
--- a/source/99_result/stream.xsl
+++ b/source/99_result/stream.xsl
@@ -28,24 +28,20 @@
</xsl:choose>
</xsl:template>
-<xsl:template name="get_article">
- <xsl:param name="handle"/>
-
- <xsl:variable name="article" select="$root/articles/entry[@handle = $handle]"/>
-
+<xsl:template match="articles/entry" mode="resolve">
<h2>
<xsl:text>ยป </xsl:text>
- <a href="/article/{$handle}">
- <xsl:value-of select="$article/title"/>
+ <a href="/article/{@handle}">
+ <xsl:value-of select="title"/>
</a>
</h2>
<p class="info">
<xsl:call-template name="format-date">
- <xsl:with-param name="date" select="$article/date/full"/>
+ <xsl:with-param name="date" select="date/full"/>
<xsl:with-param name="format" select="'M x, Y'"/>
- </xsl:call-template>
+ </xsl:call-template>
<xsl:text> | </xsl:text>
- <xsl:for-each select="$article/tags/tag">
+ <xsl:for-each select="tags/tag">
<a href="/tag/{.}">
<xsl:value-of select="."/>
</a>
@@ -55,7 +51,7 @@
<xsl:value-of select="$root/meta/author"/>
</p>
- <xsl:apply-templates select="$article/content/node()" mode="xhtml"/>
+ <xsl:apply-templates select="content/node()" mode="xhtml"/>
</xsl:template>
<xsl:template match="page/entry">
@@ -80,19 +76,17 @@
</xsl:template>
<xsl:template match="page/entry/article">
+ <xsl:variable name="handle" select="@handle"/>
+
<xsl:choose>
<xsl:when test="position() = last()">
<div class="last article">
- <xsl:call-template name="get_article">
- <xsl:with-param name="handle" select="@handle"/>
- </xsl:call-template>
+ <xsl:apply-templates select="$root/articles/entry[@handle = $handle]" mode="resolve"/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="article">
- <xsl:call-template name="get_article">
- <xsl:with-param name="handle" select="@handle"/>
- </xsl:call-template>
+ <xsl:apply-templates select="$root/articles/entry[@handle = $handle]" mode="resolve"/>
</div>
</xsl:otherwise>
</xsl:choose>