aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-03 21:11:52 +0200
committerAdrian Kummerlaender2014-09-03 21:11:52 +0200
commit6150e834e72000dfd4005789d3a1ef9b542802f1 (patch)
tree134c30aa0335f1f7a831c3da9c69be0152ac7680 /source
parent62d309c963eb31cfdce22a867c004072c8f9aaa1 (diff)
downloadblog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar.gz
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar.bz2
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar.lz
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar.xz
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.tar.zst
blog.kummerlaender.eu-6150e834e72000dfd4005789d3a1ef9b542802f1.zip
Revamped transformation layout to remove need for the "01_files" level
* "01_files" contained a single "source" transformation which listed the contents of the "00_content" level ** this was unnecessary as the base "list" transformation already lists the contents of all levels * added new "expression" mode to datasource meta tag processing in the task processing transformation ** this expression modes allows for the evaluation of arbitrary XPath statements *** e.g. a query to the results of "list.xsl" * modified base transformation datasource structures to include the level and meta tree * modified all existing content transformations to query the level-tree instead of the deprecated "source.xml" ** i.e. XPath statements ** the main change is that directories are available as "directory" nodes instead of nodes named by the directory name * these changes where implemented to simplify the architecture and to increase flexibility
Diffstat (limited to 'source')
-rw-r--r--source/01_data/articles.xsl (renamed from source/02_data/articles.xsl)18
-rw-r--r--source/01_data/pages.xsl (renamed from source/02_data/pages.xsl)6
-rw-r--r--source/01_data/tags.xsl26
-rw-r--r--source/01_files/source.xsl50
-rw-r--r--source/02_data/tags.xsl26
-rw-r--r--source/02_meta/articles.xsl (renamed from source/03_meta/articles.xsl)2
-rw-r--r--source/02_meta/categories.xsl (renamed from source/03_meta/categories.xsl)12
-rw-r--r--source/02_meta/meta.xsl (renamed from source/03_meta/meta.xsl)2
-rw-r--r--source/02_meta/paginated_articles.xsl (renamed from source/03_meta/paginated_articles.xsl)2
-rw-r--r--source/02_meta/tags.xsl (renamed from source/03_meta/tags.xsl)4
-rw-r--r--source/99_result/archive.xsl4
-rw-r--r--source/99_result/article/article.xsl4
-rw-r--r--source/99_result/atom.xsl4
-rw-r--r--source/99_result/category/category.xsl4
-rw-r--r--source/99_result/page/page.xsl4
-rw-r--r--source/99_result/stream.xsl6
-rw-r--r--source/99_result/tag/tag.xsl4
17 files changed, 64 insertions, 114 deletions
diff --git a/source/02_data/articles.xsl b/source/01_data/articles.xsl
index 3a71cc2..8e65f40 100644
--- a/source/02_data/articles.xsl
+++ b/source/01_data/articles.xsl
@@ -11,7 +11,7 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="01_files/source.xml" target="files"/>
+ <datasource type="main" mode="expression" source="$root/source/directory[1]/directory" target="files"/>
<target mode="plain" value="articles.xml"/>
</xsl:variable>
@@ -47,18 +47,18 @@
<xsl:template name="list_tags">
<xsl:param name="path"/>
- <xsl:for-each select="$root/files/tags/*[./file/full = $path]">
- <tag><xsl:value-of select="name()"/></tag>
+ <xsl:for-each select="$root/files/directory[@name = 'tags']/*[./file/full = $path]">
+ <tag><xsl:value-of select="@name"/></tag>
</xsl:for-each>
</xsl:template>
-<xsl:template match="files/articles">
+<xsl:template match="files/directory[@name = 'articles']">
<xsl:apply-templates select="file">
- <xsl:sort select="name" order="descending"/>
+ <xsl:sort select="@name" order="descending"/>
</xsl:apply-templates>
</xsl:template>
-<xsl:template match="files/articles/file[./extension = '.md']">
+<xsl:template match="files/directory[@name = 'articles']/file[@extension = '.md']">
<xsl:variable name="content">
<xsl:call-template name="formatter">
<xsl:with-param name="format">kramdown</xsl:with-param>
@@ -66,16 +66,16 @@
</xsl:call-template>
</xsl:variable>
- <entry handle="{substring(./name, 12, string-length(./name))}">
+ <entry handle="{substring(@name, 12, string-length(@name))}">
<title>
<xsl:value-of select="xalan:nodeset($content)/h1"/>
</title>
<date>
<full>
- <xsl:value-of select="substring(./name, 0, 11)"/>
+ <xsl:value-of select="substring(@name, 0, 11)"/>
</full>
<year>
- <xsl:value-of select="substring(./name, 0, 5)"/>
+ <xsl:value-of select="substring(@name, 0, 5)"/>
</year>
</date>
<tags>
diff --git a/source/02_data/pages.xsl b/source/01_data/pages.xsl
index 2123dae..cdfa6d4 100644
--- a/source/02_data/pages.xsl
+++ b/source/01_data/pages.xsl
@@ -11,11 +11,11 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="01_files/source.xml" target="files"/>
+ <datasource type="main" mode="expression" source="$root/source/directory[1]/directory" target="files"/>
<target mode="plain" value="pages.xml"/>
</xsl:variable>
-<xsl:template match="files/pages//file[./extension = '.md']">
+<xsl:template match="files/directory[@name = 'pages']//file[@extension = '.md']">
<xsl:variable name="content">
<xsl:call-template name="formatter">
<xsl:with-param name="format">kramdown</xsl:with-param>
@@ -23,7 +23,7 @@
</xsl:call-template>
</xsl:variable>
- <entry handle="{./name}">
+ <entry handle="{@name}">
<title>
<xsl:value-of select="xalan:nodeset($content)/h1"/>
</title>
diff --git a/source/01_data/tags.xsl b/source/01_data/tags.xsl
new file mode 100644
index 0000000..bfd227b
--- /dev/null
+++ b/source/01_data/tags.xsl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="expression" source="$root/source/directory[1]/directory" target="files"/>
+ <target mode="plain" value="tags.xml"/>
+</xsl:variable>
+
+<xsl:template match="files/directory[@name = 'tags']/directory">
+ <entry handle="{@name}">
+ <xsl:apply-templates select="file">
+ <xsl:sort select="@name" order="descending"/>
+ </xsl:apply-templates>
+ </entry>
+</xsl:template>
+
+<xsl:template match="directory[@name = 'tags']/*/file[@extension = '.md']">
+ <article handle="{substring(@name, 12, string-length(@name))}"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/01_files/source.xsl b/source/01_files/source.xsl
deleted file mode 100644
index 1648c73..0000000
--- a/source/01_files/source.xsl
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:InputXSLT="function.inputxslt.application"
- exclude-result-prefixes="InputXSLT"
->
-
-<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"/>
- <target mode="plain" value="source.xml"/>
-</xsl:variable>
-
-<xsl:template name="list_source">
- <xsl:param name="base"/>
-
- <xsl:for-each select="InputXSLT:read-directory($base)/entry">
- <xsl:choose>
- <xsl:when test="@type = 'directory'">
- <xsl:element name="{./name}">
- <xsl:call-template name="list_source">
- <xsl:with-param name="base" select="./full"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <file>
- <xsl:copy-of select="./*"/>
- </file>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template match="datasource">
- <xsl:call-template name="list_source">
- <xsl:with-param name="base">[source/00_content]</xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/source/02_data/tags.xsl b/source/02_data/tags.xsl
deleted file mode 100644
index b615213..0000000
--- a/source/02_data/tags.xsl
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
->
-
-<xsl:include href="[utility/datasource.xsl]"/>
-
-<xsl:variable name="meta">
- <datasource type="main" mode="full" source="01_files/source.xml" target="files"/>
- <target mode="plain" value="tags.xml"/>
-</xsl:variable>
-
-<xsl:template match="files/tags/*">
- <entry handle="{name()}">
- <xsl:apply-templates select="file">
- <xsl:sort select="name" order="descending"/>
- </xsl:apply-templates>
- </entry>
-</xsl:template>
-
-<xsl:template match="tags/*/file[./extension = '.md']">
- <article handle="{substring(./name, 12, string-length(./name))}"/>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/source/03_meta/articles.xsl b/source/02_meta/articles.xsl
index 8babed3..1a8b8fa 100644
--- a/source/03_meta/articles.xsl
+++ b/source/02_meta/articles.xsl
@@ -7,7 +7,7 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="02_data/articles.xml" target="articles"/>
+ <datasource type="main" mode="full" source="01_data/articles.xml" target="articles"/>
<target mode="plain" value="articles.xml"/>
</xsl:variable>
diff --git a/source/03_meta/categories.xsl b/source/02_meta/categories.xsl
index f1c2f5e..c0075b0 100644
--- a/source/03_meta/categories.xsl
+++ b/source/02_meta/categories.xsl
@@ -10,8 +10,8 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="01_files/source.xml" target="files"/>
- <datasource type="support" mode="full" source="02_data/pages.xml" target="pages"/>
+ <datasource type="main" mode="expression" source="$root/source/directory[1]/directory" target="files"/>
+ <datasource type="support" mode="full" source="01_data/pages.xml" target="pages"/>
<target mode="plain" value="categories.xml"/>
</xsl:variable>
@@ -30,15 +30,15 @@
</page>
</xsl:template>
-<xsl:template match="files/pages/*[name() != 'file']">
- <entry handle="{name()}">
+<xsl:template match="files/directory[@name = 'pages']/directory">
+ <entry handle="{@name}">
<xsl:apply-templates />
</entry>
</xsl:template>
-<xsl:template match="files/pages/*/file[./extension = '.md']">
+<xsl:template match="files/directory[@name = 'pages']/*/file[@extension = '.md']">
<xsl:call-template name="get_page_data">
- <xsl:with-param name="handle" select="./name"/>
+ <xsl:with-param name="handle" select="@name"/>
</xsl:call-template>
</xsl:template>
diff --git a/source/03_meta/meta.xsl b/source/02_meta/meta.xsl
index 2af78de..f0c48d7 100644
--- a/source/03_meta/meta.xsl
+++ b/source/02_meta/meta.xsl
@@ -8,7 +8,7 @@
<xsl:variable name="meta">
<datasource type="main" mode="full" source="00_content/meta.xml" target="meta"/>
- <datasource type="support" mode="full" source="02_data/tags.xml" target="tags"/>
+ <datasource type="support" mode="full" source="01_data/tags.xml" target="tags"/>
<target mode="plain" value="meta.xml"/>
</xsl:variable>
diff --git a/source/03_meta/paginated_articles.xsl b/source/02_meta/paginated_articles.xsl
index e00ee51..9fb38a9 100644
--- a/source/03_meta/paginated_articles.xsl
+++ b/source/02_meta/paginated_articles.xsl
@@ -7,7 +7,7 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="02_data/articles.xml" target="articles"/>
+ <datasource type="main" mode="full" source="01_data/articles.xml" target="articles"/>
<target mode="plain" value="paginated_articles.xml"/>
</xsl:variable>
diff --git a/source/03_meta/tags.xsl b/source/02_meta/tags.xsl
index 9e399cd..20b1f10 100644
--- a/source/03_meta/tags.xsl
+++ b/source/02_meta/tags.xsl
@@ -7,8 +7,8 @@
<xsl:include href="[utility/datasource.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="02_data/tags.xml" target="tags"/>
- <datasource type="support" mode="full" source="02_data/articles.xml" target="articles"/>
+ <datasource type="main" mode="full" source="01_data/tags.xml" target="tags"/>
+ <datasource type="support" mode="full" source="01_data/articles.xml" target="articles"/>
<target mode="plain" value="tags.xml"/>
</xsl:variable>
diff --git a/source/99_result/archive.xsl b/source/99_result/archive.xsl
index a6e8bce..62861a5 100644
--- a/source/99_result/archive.xsl
+++ b/source/99_result/archive.xsl
@@ -7,8 +7,8 @@
<xsl:include href="[utility/master.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="03_meta/articles.xml" target="articles"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <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"/>
</xsl:variable>
diff --git a/source/99_result/article/article.xsl b/source/99_result/article/article.xsl
index 0dadf76..68ba2d8 100644
--- a/source/99_result/article/article.xsl
+++ b/source/99_result/article/article.xsl
@@ -8,8 +8,8 @@
<xsl:include href="[utility/date-time.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="iterate" source="02_data/articles.xml" target="article"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <datasource type="main" mode="iterate" source="01_data/articles.xml" target="article"/>
+ <datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
<target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/article/entry/@handle, '/index.html')"/>
</xsl:variable>
diff --git a/source/99_result/atom.xsl b/source/99_result/atom.xsl
index c2cced8..e67f89c 100644
--- a/source/99_result/atom.xsl
+++ b/source/99_result/atom.xsl
@@ -12,8 +12,8 @@
/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="02_data/articles.xml" target="articles"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="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"/>
</xsl:variable>
diff --git a/source/99_result/category/category.xsl b/source/99_result/category/category.xsl
index 300b62f..ce6cb1d 100644
--- a/source/99_result/category/category.xsl
+++ b/source/99_result/category/category.xsl
@@ -9,8 +9,8 @@
<xsl:include href="[utility/master.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="iterate" source="03_meta/categories.xml" target="category"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <datasource type="main" mode="iterate" source="02_meta/categories.xml" target="category"/>
+ <datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
<target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/category/entry/@handle, '/index.html')"/>
</xsl:variable>
diff --git a/source/99_result/page/page.xsl b/source/99_result/page/page.xsl
index ccee1de..3fb2431 100644
--- a/source/99_result/page/page.xsl
+++ b/source/99_result/page/page.xsl
@@ -7,8 +7,8 @@
<xsl:include href="[utility/master.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="iterate" source="02_data/pages.xml" target="page"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <datasource type="main" mode="iterate" source="01_data/pages.xml" target="page"/>
+ <datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
<target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/page/entry/@handle, '/index.html')"/>
</xsl:variable>
diff --git a/source/99_result/stream.xsl b/source/99_result/stream.xsl
index 7db2410..8f9c9d6 100644
--- a/source/99_result/stream.xsl
+++ b/source/99_result/stream.xsl
@@ -8,9 +8,9 @@
<xsl:include href="[utility/date-time.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="iterate" source="03_meta/paginated_articles.xml" target="page"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
- <datasource type="support" mode="full" source="02_data/articles.xml" target="articles"/>
+ <datasource type="main" mode="iterate" source="02_meta/paginated_articles.xml" target="page"/>
+ <datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
+ <datasource type="support" mode="full" source="01_data/articles.xml" target="articles"/>
<target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/page/entry/@index, '/index.html')"/>
</xsl:variable>
diff --git a/source/99_result/tag/tag.xsl b/source/99_result/tag/tag.xsl
index 511a64f..a941751 100644
--- a/source/99_result/tag/tag.xsl
+++ b/source/99_result/tag/tag.xsl
@@ -7,8 +7,8 @@
<xsl:include href="[utility/master.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="iterate" source="03_meta/tags.xml" target="tag"/>
- <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <datasource type="main" mode="iterate" source="02_meta/tags.xml" target="tag"/>
+ <datasource type="support" mode="full" source="02_meta/meta.xml" target="meta"/>
<target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/tag/entry/@handle, '/index.html')"/>
</xsl:variable>