diff options
Removed need for prefixing datasource source attribute
* transformations contain one or more "datasource" meta nodes
** these nodes define the required datasources
** up until now it was required to define the whole path to the file to be loaded
* the implementation of directory linkage in b942f8e removed the underlying need for providing the source / target prefix
** this commit now updates the generation transformations to match this change
*** this simplifies the datasource definition process for the end-user
*** additionally it makes the target / source directories easier to maintain
* changed cleanage task implementation to remove the whole directory and recreate it from scratch
** otherwise directory linkage and in turn the whole generation failed when the target directory did not exist in the first place
* removed task reordering in the process transformation
** tasks are now processed exactly as they were scheduled
** this was changed so that e.g. the "00_content" directory is linked before the first datasource is required
-rw-r--r-- | plan.xsl | 5 | ||||
-rw-r--r-- | process.xsl | 58 | ||||
-rw-r--r-- | source/02_data/articles.xsl | 2 | ||||
-rw-r--r-- | source/02_data/pages.xsl | 2 | ||||
-rw-r--r-- | source/02_data/tags.xsl | 2 | ||||
-rw-r--r-- | source/03_meta/articles.xsl | 2 | ||||
-rw-r--r-- | source/03_meta/categories.xsl | 4 | ||||
-rw-r--r-- | source/03_meta/meta.xsl | 4 | ||||
-rw-r--r-- | source/03_meta/paginated_articles.xsl | 2 | ||||
-rw-r--r-- | source/03_meta/tags.xsl | 4 | ||||
-rw-r--r-- | source/99_result/archive.xsl | 6 | ||||
-rw-r--r-- | source/99_result/article/article.xsl | 4 | ||||
-rw-r--r-- | source/99_result/atom.xsl | 4 | ||||
-rw-r--r-- | source/99_result/category/category.xsl | 4 | ||||
-rw-r--r-- | source/99_result/page/page.xsl | 4 | ||||
-rw-r--r-- | source/99_result/stream.xsl | 6 | ||||
-rw-r--r-- | source/99_result/tag/tag.xsl | 4 |
17 files changed, 63 insertions, 54 deletions
@@ -50,6 +50,11 @@ <xsl:choose> <xsl:when test="@extension = '.xsl'"> <task type="generate"> + <meta> + <datasource_prefix> + <xsl:value-of select="$target"/> + </datasource_prefix> + </meta> <source> <xsl:value-of select="concat($source, '/', $path, '/', @name, @extension)"/> </source> diff --git a/process.xsl b/process.xsl index 29efc0e..595d617 100644 --- a/process.xsl +++ b/process.xsl @@ -30,7 +30,7 @@ <xsl:param name="path"/> <xsl:value-of select="InputXSLT:external-command( - concat('rm -r ./', $path, '/*') + concat('rm -r ./', $path, '; mkdir ./', $path) )/self::command/@result"/> </xsl:template> @@ -87,13 +87,16 @@ </xsl:template> <xsl:template name="resolve_datasource"> + <xsl:param name="prefix"/> <xsl:param name="datasource"/> <xsl:for-each select="$datasource"> <xsl:element name="{@target}"> <xsl:choose> <xsl:when test="@mode = 'full'"> - <xsl:copy-of select="InputXSLT:read-file(@source)/self::file/*/*"/> + <xsl:copy-of select="InputXSLT:read-file( + concat($prefix, '/', @source) + )/self::file/*/*"/> </xsl:when> </xsl:choose> </xsl:element> @@ -104,6 +107,7 @@ <xsl:param name="main"/> <xsl:param name="support"/> <xsl:param name="transformation"/> + <xsl:param name="datasource_prefix"/> <xsl:param name="target_prefix"/> <xsl:param name="target"/> @@ -112,6 +116,7 @@ <xsl:with-param name="main" select="$main"/> <xsl:with-param name="support"> <xsl:call-template name="resolve_datasource"> + <xsl:with-param name="prefix" select="$datasource_prefix"/> <xsl:with-param name="datasource" select="$support"/> </xsl:call-template> </xsl:with-param> @@ -134,10 +139,9 @@ </xsl:template> <xsl:template name="process"> - <xsl:param name="source"/> - <xsl:param name="target"/> + <xsl:param name="task"/> - <xsl:variable name="transformation" select="InputXSLT:read-file($source)/self::file/node()"/> + <xsl:variable name="transformation" select="InputXSLT:read-file($task/source)/self::file/node()"/> <xsl:variable name="meta" select="$transformation/self::*[name() = 'xsl:stylesheet']/*[name() = 'xsl:variable' and @name = 'meta']"/> <xsl:variable name="main_source" select="$meta/datasource[@type = 'main']"/> <xsl:variable name="support_source" select="$meta/datasource[@type = 'support']"/> @@ -147,36 +151,43 @@ <xsl:call-template name="compile"> <xsl:with-param name="main"> <xsl:element name="{$main_source/@target}"> - <xsl:copy-of select="InputXSLT:read-file($main_source/@source)/self::file/*/*"/> + <xsl:copy-of select="InputXSLT:read-file( + concat($task/meta/datasource_prefix, '/', $main_source/@source) + )/self::file/*/*"/> </xsl:element> </xsl:with-param> - <xsl:with-param name="support" select="$support_source"/> - <xsl:with-param name="transformation" select="$transformation"/> - <xsl:with-param name="target_prefix" select="$target"/> - <xsl:with-param name="target" select="$meta/target"/> + <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:when test="$main_source/@mode = 'iterate'"> - <xsl:for-each select="InputXSLT:read-file($main_source/@source)/self::file/*/entry"> + <xsl:for-each select="InputXSLT:read-file( + concat($task/meta/datasource_prefix, '/', $main_source/@source) + )/self::file/*/entry"> <xsl:call-template name="compile"> <xsl:with-param name="main"> <xsl:element name="{$main_source/@target}"> <xsl:copy-of select="."/> </xsl:element> </xsl:with-param> - <xsl:with-param name="support" select="$support_source"/> - <xsl:with-param name="transformation" select="$transformation"/> - <xsl:with-param name="target_prefix" select="$target"/> - <xsl:with-param name="target" select="$meta/target"/> + <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:for-each> </xsl:when> <xsl:otherwise> <xsl:call-template name="compile"> - <xsl:with-param name="support" select="$support_source"/> - <xsl:with-param name="transformation" select="$transformation"/> - <xsl:with-param name="target_prefix" select="$target"/> - <xsl:with-param name="target" select="$meta/target"/> + <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:otherwise> </xsl:choose> @@ -196,8 +207,7 @@ <xsl:template match="task[@type = 'generate']"> <xsl:variable name="results"> <xsl:call-template name="process"> - <xsl:with-param name="source" select="source"/> - <xsl:with-param name="target" select="target"/> + <xsl:with-param name="task" select="."/> </xsl:call-template> </xsl:variable> @@ -232,10 +242,4 @@ </xsl:copy> </xsl:template> -<xsl:template match="datasource"> - <xsl:apply-templates select="task[@type = 'clean']"/> - <xsl:apply-templates select="task[@type = 'generate']"/> - <xsl:apply-templates select="task[@type = 'link']"/> -</xsl:template> - </xsl:stylesheet> diff --git a/source/02_data/articles.xsl b/source/02_data/articles.xsl index 7b951df..3a71cc2 100644 --- a/source/02_data/articles.xsl +++ b/source/02_data/articles.xsl @@ -11,7 +11,7 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/01_files/source.xml" target="files"/> + <datasource type="main" mode="full" source="01_files/source.xml" target="files"/> <target mode="plain" value="articles.xml"/> </xsl:variable> diff --git a/source/02_data/pages.xsl b/source/02_data/pages.xsl index 30a14f8..2123dae 100644 --- a/source/02_data/pages.xsl +++ b/source/02_data/pages.xsl @@ -11,7 +11,7 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/01_files/source.xml" target="files"/> + <datasource type="main" mode="full" source="01_files/source.xml" target="files"/> <target mode="plain" value="pages.xml"/> </xsl:variable> diff --git a/source/02_data/tags.xsl b/source/02_data/tags.xsl index 35c360e..b615213 100644 --- a/source/02_data/tags.xsl +++ b/source/02_data/tags.xsl @@ -7,7 +7,7 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/01_files/source.xml" target="files"/> + <datasource type="main" mode="full" source="01_files/source.xml" target="files"/> <target mode="plain" value="tags.xml"/> </xsl:variable> diff --git a/source/03_meta/articles.xsl b/source/03_meta/articles.xsl index e9a54c3..8babed3 100644 --- a/source/03_meta/articles.xsl +++ b/source/03_meta/articles.xsl @@ -7,7 +7,7 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/02_data/articles.xml" target="articles"/> + <datasource type="main" mode="full" source="02_data/articles.xml" target="articles"/> <target mode="plain" value="articles.xml"/> </xsl:variable> diff --git a/source/03_meta/categories.xsl b/source/03_meta/categories.xsl index a2945b3..f1c2f5e 100644 --- a/source/03_meta/categories.xsl +++ b/source/03_meta/categories.xsl @@ -10,8 +10,8 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/01_files/source.xml" target="files"/> - <datasource type="support" mode="full" source="target/02_data/pages.xml" target="pages"/> + <datasource type="main" mode="full" source="01_files/source.xml" target="files"/> + <datasource type="support" mode="full" source="02_data/pages.xml" target="pages"/> <target mode="plain" value="categories.xml"/> </xsl:variable> diff --git a/source/03_meta/meta.xsl b/source/03_meta/meta.xsl index 91c09b3..2af78de 100644 --- a/source/03_meta/meta.xsl +++ b/source/03_meta/meta.xsl @@ -7,8 +7,8 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="source/00_content/meta.xml" target="meta"/> - <datasource type="support" mode="full" source="target/02_data/tags.xml" target="tags"/> + <datasource type="main" mode="full" source="00_content/meta.xml" target="meta"/> + <datasource type="support" mode="full" source="02_data/tags.xml" target="tags"/> <target mode="plain" value="meta.xml"/> </xsl:variable> diff --git a/source/03_meta/paginated_articles.xsl b/source/03_meta/paginated_articles.xsl index 61439b8..e00ee51 100644 --- a/source/03_meta/paginated_articles.xsl +++ b/source/03_meta/paginated_articles.xsl @@ -7,7 +7,7 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/02_data/articles.xml" target="articles"/> + <datasource type="main" mode="full" source="02_data/articles.xml" target="articles"/> <target mode="plain" value="paginated_articles.xml"/> </xsl:variable> diff --git a/source/03_meta/tags.xsl b/source/03_meta/tags.xsl index 7caf37f..9e399cd 100644 --- a/source/03_meta/tags.xsl +++ b/source/03_meta/tags.xsl @@ -7,8 +7,8 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/02_data/tags.xml" target="tags"/> - <datasource type="support" mode="full" source="target/02_data/articles.xml" target="articles"/> + <datasource type="main" mode="full" source="02_data/tags.xml" target="tags"/> + <datasource type="support" mode="full" source="02_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 4d459c4..a6e8bce 100644 --- a/source/99_result/archive.xsl +++ b/source/99_result/archive.xsl @@ -7,9 +7,9 @@ <xsl:include href="[utility/master.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="target/03_meta/articles.xml" target="articles"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="meta"/> - <datasource type="support" mode="full" source="source/00_content/microblog.xml" target="microblog"/> + <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="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 bbde793..1a6d2eb 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="target/02_data/articles.xml" target="article"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="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"/> <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 da7f370..bfd038b 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="target/02_data/articles.xml" target="articles"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="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"/> <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 e69640b..300b62f 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="target/03_meta/categories.xml" target="category"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="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"/> <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 4bf62ba..ccee1de 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="target/02_data/pages.xml" target="page"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="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"/> <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 526b8db..4d93a2c 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="target/03_meta/paginated_articles.xml" target="page"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="meta"/> - <datasource type="support" mode="full" source="target/02_data/articles.xml" target="articles"/> + <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"/> <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 fd79a3c..511a64f 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="target/03_meta/tags.xml" target="tag"/> - <datasource type="support" mode="full" source="target/03_meta/meta.xml" target="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"/> <target mode="xpath" value="concat(xalan:nodeset($datasource)/datasource/tag/entry/@handle, '/index.html')"/> </xsl:variable> |