aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-07-21 17:08:24 +0200
committerAdrian Kummerlaender2014-07-21 17:08:24 +0200
commit1bc72443aeb488966b596323817c6b95e8d196ac (patch)
tree0de8b60b9a818570f5f689c9193bfc856f545745
parent6265f7f4be3a54a8a27330918c59ef16da458124 (diff)
downloadblog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar.gz
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar.bz2
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar.lz
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar.xz
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.tar.zst
blog.kummerlaender.eu-1bc72443aeb488966b596323817c6b95e8d196ac.zip
Moved compiler template parameters into variables
* they are overlapping between the different main datasource modes
-rw-r--r--generate.xsl42
1 files changed, 22 insertions, 20 deletions
diff --git a/generate.xsl b/generate.xsl
index 405f940..f256c9d 100644
--- a/generate.xsl
+++ b/generate.xsl
@@ -79,47 +79,49 @@
<xsl:variable name="level" select="."/>
<xsl:for-each select="InputXSLT:read-directory(./full)/entry[./extension = '.xsl']">
- <xsl:variable name="transformation" select="."/>
- <xsl:variable name="stylesheet" select="InputXSLT:read-file($transformation/full)/self::file/*"/>
- <xsl:variable name="meta" select="$stylesheet/self::*[name() = 'xsl:stylesheet']/*[name() = 'xsl:variable' and @name = 'meta']"/>
- <xsl:variable name="main" select="$meta/datasource[@type = 'main']"/>
+ <xsl:variable name="transformation" select="InputXSLT:read-file(./full)/self::file/*"/>
+ <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']"/>
+ <xsl:variable name="target_prefix" select="concat('target/', $level/name)"/>
+ <xsl:variable name="target" select="$meta/target"/>
<xsl:choose>
- <xsl:when test="$main/@mode = 'full'">
+ <xsl:when test="$main_source/@mode = 'full'">
<xsl:call-template name="compiler">
<xsl:with-param name="input">
<xsl:call-template name="datasource">
<xsl:with-param name="main">
- <xsl:element name="{$main/@target}">
- <xsl:copy-of select="InputXSLT:read-file($main/@source)/self::file/*/*"/>
+ <xsl:element name="{$main_source/@target}">
+ <xsl:copy-of select="InputXSLT:read-file($main_source/@source)/self::file/*/*"/>
</xsl:element>
</xsl:with-param>
- <xsl:with-param name="support" select="$meta/datasource[@type = 'support']"/>
+ <xsl:with-param name="support" select="$support_source"/>
</xsl:call-template>
</xsl:with-param>
- <xsl:with-param name="transformation" select="$stylesheet"/>
- <xsl:with-param name="target_prefix" select="concat('target/', $level/name)"/>
- <xsl:with-param name="target" select="$meta/target"/>
+ <xsl:with-param name="transformation" select="$transformation"/>
+ <xsl:with-param name="target_prefix" select="$target_prefix"/>
+ <xsl:with-param name="target" select="$target"/>
</xsl:call-template>
</xsl:when>
- <xsl:when test="$main/@mode = 'iterate'">
- <xsl:variable name="datasource" select="InputXSLT:read-file($main/@source)/self::file/*"/>
+ <xsl:when test="$main_source/@mode = 'iterate'">
+ <xsl:variable name="datasource" select="InputXSLT:read-file($main_source/@source)/self::file/*"/>
<xsl:for-each select="$datasource/entry">
<xsl:call-template name="compiler">
<xsl:with-param name="input">
<xsl:call-template name="datasource">
<xsl:with-param name="main">
- <xsl:element name="{$main/@target}">
+ <xsl:element name="{$main_source/@target}">
<xsl:copy-of select="."/>
</xsl:element>
</xsl:with-param>
<xsl:with-param name="support" select="$meta/datasource[@type = 'support']"/>
</xsl:call-template>
</xsl:with-param>
- <xsl:with-param name="transformation" select="$stylesheet"/>
- <xsl:with-param name="target_prefix" select="concat('target/', $level/name)"/>
- <xsl:with-param name="target" select="$meta/target"/>
+ <xsl:with-param name="transformation" select="$transformation"/>
+ <xsl:with-param name="target_prefix" select="$target_prefix"/>
+ <xsl:with-param name="target" select="$target"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
@@ -130,9 +132,9 @@
<xsl:with-param name="support" select="$meta/datasource[@type = 'support']"/>
</xsl:call-template>
</xsl:with-param>
- <xsl:with-param name="transformation" select="$stylesheet"/>
- <xsl:with-param name="target_prefix" select="concat('target/', $level/name)"/>
- <xsl:with-param name="target" select="$meta/target"/>
+ <xsl:with-param name="transformation" select="$transformation"/>
+ <xsl:with-param name="target_prefix" select="$target_prefix"/>
+ <xsl:with-param name="target" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>