aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-08-23 22:08:29 +0200
committerAdrian Kummerlaender2014-08-23 22:08:29 +0200
commit095905fbc32c971b8847bf5c3dd32f3409c9b46b (patch)
treee4a144c844c4ee83756b1ce7518e678c8ca8f9b4
parent451df2a01502ef04ef32973f4a80d90195d47b3d (diff)
downloadblog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar.gz
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar.bz2
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar.lz
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar.xz
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.tar.zst
blog.kummerlaender.eu-095905fbc32c971b8847bf5c3dd32f3409c9b46b.zip
Expanded output of task processing
* partly copy "task" nodes ** augment with result of performing the task * executions of single transformations which expand into multiple target files are now grouped into tasks and subtasks ** a total result value is determined * this change was implemented to aid the implementation of a "generation-digest" view ** such a "view" summarizes the results of task processing and may be configured in e.g. verbosity and error output
-rw-r--r--process.xsl114
1 files changed, 74 insertions, 40 deletions
diff --git a/process.xsl b/process.xsl
index d8f2aab..a054965 100644
--- a/process.xsl
+++ b/process.xsl
@@ -17,47 +17,40 @@
<xsl:include href="utility/helper.xsl"/>
-<xsl:template name="generate">
- <xsl:param name="input"/>
- <xsl:param name="transformation"/>
- <xsl:param name="target"/>
-
- <xsl:copy-of select="InputXSLT:generate(
- $input,
- $transformation,
- $target
- )/self::generation"/>
-</xsl:template>
-
-<xsl:template name="linker">
+<xsl:template name="create_link">
<xsl:param name="from"/>
<xsl:param name="to"/>
- <linkage from="./{$from}" to="./{$to}" result="{InputXSLT:external-command(
+ <xsl:value-of select="InputXSLT:external-command(
concat('ln -sr ./', $to, ' ./', $from)
- )/self::command/@result}"/>
+ )/self::command/@result"/>
</xsl:template>
-<xsl:template name="cleaner">
+<xsl:template name="clean">
<xsl:param name="path"/>
- <cleaning path="./{$path}" result="{InputXSLT:external-command(
+ <xsl:value-of select="InputXSLT:external-command(
concat('rm -r ./', $path, '/*')
- )/self::command/@result}"/>
+ )/self::command/@result"/>
</xsl:template>
-<xsl:template name="resolve_datasource">
- <xsl:param name="datasource"/>
+<xsl:template name="generate">
+ <xsl:param name="input"/>
+ <xsl:param name="transformation"/>
+ <xsl:param name="target"/>
- <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:when>
- </xsl:choose>
- </xsl:element>
- </xsl:for-each>
+ <subtask>
+ <xsl:attribute name="result">
+ <xsl:value-of select="InputXSLT:generate(
+ $input,
+ $transformation,
+ $target
+ )/self::generation/@result"/>
+ </xsl:attribute>
+ <target>
+ <xsl:value-of select="$target"/>
+ </target>
+ </subtask>
</xsl:template>
<xsl:template name="resolve_target">
@@ -75,6 +68,20 @@
</xsl:choose>
</xsl:template>
+<xsl:template name="resolve_datasource">
+ <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:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+</xsl:template>
+
<xsl:template name="compile">
<xsl:param name="main"/>
<xsl:param name="support"/>
@@ -158,23 +165,50 @@
</xsl:template>
<xsl:template match="task[@type = 'clean']">
- <xsl:call-template name="cleaner">
- <xsl:with-param name="path" select="path"/>
- </xsl:call-template>
+ <xsl:copy>
+ <xsl:attribute name="result">
+ <xsl:call-template name="clean">
+ <xsl:with-param name="path" select="path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="@* | node()"/>
+ </xsl:copy>
</xsl:template>
<xsl:template match="task[@type = 'generate']">
- <xsl:call-template name="process">
- <xsl:with-param name="source" select="source"/>
- <xsl:with-param name="target" select="target"/>
- </xsl:call-template>
+ <xsl:variable name="results">
+ <xsl:call-template name="process">
+ <xsl:with-param name="source" select="source"/>
+ <xsl:with-param name="target" select="target"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:copy>
+ <xsl:attribute name="result">
+ <xsl:choose>
+ <xsl:when test="count(xalan:nodeset($results)/subtask[@result = 'success']) = count(xalan:nodeset($results)/subtask)">
+ <xsl:text>success</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>error</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:copy-of select="@* | source"/>
+ <xsl:copy-of select="$results"/>
+ </xsl:copy>
</xsl:template>
<xsl:template match="task[@type = 'link']">
- <xsl:call-template name="linker">
- <xsl:with-param name="from" select="from"/>
- <xsl:with-param name="to" select="to"/>
- </xsl:call-template>
+ <xsl:copy>
+ <xsl:attribute name="result">
+ <xsl:call-template name="create_link">
+ <xsl:with-param name="from" select="from"/>
+ <xsl:with-param name="to" select="to"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="@* | node()"/>
+ </xsl:copy>
</xsl:template>
<xsl:template match="datasource">