aboutsummaryrefslogtreecommitdiff
path: root/detail/plan.xsl
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-04 21:31:20 +0200
committerAdrian Kummerlaender2014-09-04 21:31:20 +0200
commit1921be28cc94764b2bd8c26e76d7171440b926ab (patch)
tree41daa20bb94bd2782e5e4871697fe31fe90f3a71 /detail/plan.xsl
parent4ba1e1585033643d4c656d5962f12b2a3fdbfb9e (diff)
downloadblog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar.gz
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar.bz2
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar.lz
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar.xz
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.tar.zst
blog.kummerlaender.eu-1921be28cc94764b2bd8c26e76d7171440b926ab.zip
Moved generation stage stylesheets into "detail" folder
* they are read by FunctionReadFile to and passed to FunctionGenerate as a DOM tree to execute them as if they where located in the parent directory ** this is required so they behave as expected without requiring all paths to be absolute * this change was implemented to make it clear that "make.xsl" is the main generation stylesheet ** additionally this further separates the framework implementation from the site-specific stylesheets and contents
Diffstat (limited to 'detail/plan.xsl')
-rw-r--r--detail/plan.xsl99
1 files changed, 99 insertions, 0 deletions
diff --git a/detail/plan.xsl b/detail/plan.xsl
new file mode 100644
index 0000000..2479371
--- /dev/null
+++ b/detail/plan.xsl
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:dyn="http://exslt.org/dynamic"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="dyn xalan InputXSLT"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="yes"
+ encoding="UTF-8"
+ indent="no"
+/>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+
+<xsl:template name="traverse">
+ <xsl:param name="source"/>
+ <xsl:param name="target"/>
+ <xsl:param name="path"/>
+ <xsl:param name="node"/>
+
+ <xsl:for-each select="$node/directory">
+ <xsl:choose>
+ <xsl:when test=".//file/@extension = '.xsl'">
+ <xsl:call-template name="traverse">
+ <xsl:with-param name="source" select="$source"/>
+ <xsl:with-param name="target" select="$target"/>
+ <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <task type="link">
+ <from>
+ <xsl:value-of select="concat($target, '/', $path, '/', @name)"/>
+ </from>
+ <to>
+ <xsl:value-of select="concat($source, '/', $path, '/', @name)"/>
+ </to>
+ </task>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+
+ <xsl:for-each select="$node/file">
+ <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>
+ <target>
+ <xsl:value-of select="concat($target, '/', $path)"/>
+ </target>
+ </task>
+ </xsl:when>
+ <xsl:when test="@extension = '.css'">
+ <task type="link">
+ <from>
+ <xsl:value-of select="concat($target, '/', $path, '/', @name, @extension)"/>
+ </from>
+ <to>
+ <xsl:value-of select="concat($source, '/', $path, '/', @name, @extension)"/>
+ </to>
+ </task>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="datasource">
+ <xsl:copy-of select="source"/>
+ <xsl:copy-of select="meta"/>
+
+ <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>