aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list.xsl10
-rw-r--r--make.xsl23
-rw-r--r--plan.xsl25
-rw-r--r--process.xsl17
-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
21 files changed, 114 insertions, 139 deletions
diff --git a/list.xsl b/list.xsl
index 7eba255..93585e8 100644
--- a/list.xsl
+++ b/list.xsl
@@ -13,6 +13,8 @@
indent="no"
/>
+<xsl:include href="utility/datasource.xsl"/>
+
<xsl:template name="list">
<xsl:param name="base"/>
@@ -26,16 +28,20 @@
</directory>
</xsl:when>
<xsl:otherwise>
- <file name="{./name}" extension="{./extension}"/>
+ <file name="{./name}" extension="{./extension}">
+ <xsl:copy-of select="full"/>
+ </file>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="datasource">
+ <xsl:copy-of select="meta"/>
+
<source>
<xsl:call-template name="list">
- <xsl:with-param name="base" select="."/>
+ <xsl:with-param name="base" select="meta/source"/>
</xsl:call-template>
</source>
</xsl:template>
diff --git a/make.xsl b/make.xsl
index f073910..4b932a7 100644
--- a/make.xsl
+++ b/make.xsl
@@ -14,6 +14,9 @@
indent="no"
/>
+<xsl:variable name="source">source</xsl:variable>
+<xsl:variable name="target">target</xsl:variable>
+
<xsl:template name="generate">
<xsl:param name="input"/>
<xsl:param name="transformation"/>
@@ -25,21 +28,8 @@
</xsl:template>
<xsl:template match="/">
- <xsl:variable name="source">source</xsl:variable>
- <xsl:variable name="target">target</xsl:variable>
-
<xsl:variable name="list_source">
<datasource>
- <xsl:value-of select="$source"/>
- </datasource>
- </xsl:variable>
-
- <xsl:variable name="plan_source">
- <datasource>
- <xsl:call-template name="generate">
- <xsl:with-param name="input" select="$list_source"/>
- <xsl:with-param name="transformation">list.xsl</xsl:with-param>
- </xsl:call-template>
<meta>
<source><xsl:value-of select="$source"/></source>
<target><xsl:value-of select="$target"/></target>
@@ -47,6 +37,13 @@
</datasource>
</xsl:variable>
+ <xsl:variable name="plan_source">
+ <xsl:call-template name="generate">
+ <xsl:with-param name="input" select="$list_source"/>
+ <xsl:with-param name="transformation">list.xsl</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
<xsl:variable name="process_source">
<xsl:call-template name="generate">
<xsl:with-param name="input" select="$plan_source"/>
diff --git a/plan.xsl b/plan.xsl
index 57b808c..bef6fc5 100644
--- a/plan.xsl
+++ b/plan.xsl
@@ -78,17 +78,22 @@
</xsl:template>
<xsl:template match="datasource">
- <task type="clean">
- <path>
- <xsl:value-of select="meta/target"/>
- </path>
- </task>
+ <xsl:copy-of select="source"/>
+ <xsl:copy-of select="meta"/>
- <xsl:call-template name="traverse">
- <xsl:with-param name="source" select="$root/meta/source"/>
- <xsl:with-param name="target" select="$root/meta/target"/>
- <xsl:with-param name="node" select="source"/>
- </xsl:call-template>
+ <tasks>
+ <task type="clean">
+ <path>
+ <xsl:value-of select="meta/target"/>
+ </path>
+ </task>
+
+ <xsl:call-template name="traverse">
+ <xsl:with-param name="source" select="$root/meta/source"/>
+ <xsl:with-param name="target" select="$root/meta/target"/>
+ <xsl:with-param name="node" select="source"/>
+ </xsl:call-template>
+ </tasks>
</xsl:template>
</xsl:stylesheet>
diff --git a/process.xsl b/process.xsl
index 595d617..82f4188 100644
--- a/process.xsl
+++ b/process.xsl
@@ -98,6 +98,9 @@
concat($prefix, '/', @source)
)/self::file/*/*"/>
</xsl:when>
+ <xsl:when test="@mode = 'expression'">
+ <xsl:copy-of select="dyn:evaluate(@source)"/>
+ </xsl:when>
</xsl:choose>
</xsl:element>
</xsl:for-each>
@@ -181,6 +184,20 @@
</xsl:call-template>
</xsl:for-each>
</xsl:when>
+ <xsl:when test="$main_source/@mode = 'expression'">
+ <xsl:call-template name="compile">
+ <xsl:with-param name="main">
+ <xsl:element name="{$main_source/@target}">
+ <xsl:copy-of select="dyn:evaluate($main_source/@source)"/>
+ </xsl:element>
+ </xsl:with-param>
+ <xsl:with-param name="support" select="$support_source"/>
+ <xsl:with-param name="transformation" select="$transformation"/>
+ <xsl:with-param name="datasource_prefix" select="$task/meta/datasource_prefix"/>
+ <xsl:with-param name="target_prefix" select="$task/target"/>
+ <xsl:with-param name="target" select="$meta/target"/>
+ </xsl:call-template>
+ </xsl:when>
<xsl:otherwise>
<xsl:call-template name="compile">
<xsl:with-param name="support" select="$support_source"/>
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>