aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-08-28 12:38:49 +0200
committerAdrian Kummerlaender2014-08-28 12:38:49 +0200
commit0231b111189ad201871aa0714a69163d87031f79 (patch)
tree1833e925d75134f51c850d62e07e9b2612aa1941
parent60720bddb27c763d8dfb95eae9f1b49506b3897f (diff)
downloadblog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar.gz
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar.bz2
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar.lz
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar.xz
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.tar.zst
blog.kummerlaender.eu-0231b111189ad201871aa0714a69163d87031f79.zip
Added formatted error output to the summarize transformation
* generation errors are returned in the "log" node of the appropriate task node * "summarize.xsl" transforms the nodes of all failed tasks into a easily readable plain-text version ** the output is specialized on the different task types
-rw-r--r--process.xsl18
-rw-r--r--summarize.xsl38
2 files changed, 51 insertions, 5 deletions
diff --git a/process.xsl b/process.xsl
index a0c1895..0580fa2 100644
--- a/process.xsl
+++ b/process.xsl
@@ -39,14 +39,22 @@
<xsl:param name="transformation"/>
<xsl:param name="target"/>
+ <xsl:variable name="generation_result" select="InputXSLT:generate(
+ $input,
+ $transformation,
+ $target
+ )/self::generation"/>
+
<subtask>
<xsl:attribute name="result">
- <xsl:value-of select="InputXSLT:generate(
- $input,
- $transformation,
- $target
- )/self::generation/@result"/>
+ <xsl:value-of select="$generation_result/@result"/>
</xsl:attribute>
+ <xsl:if test="$generation_result/@result = 'error'">
+ <log>
+ <xsl:copy-of select="$generation_result/error"/>
+ </log>
+ </xsl:if>
+
<target>
<xsl:value-of select="$target"/>
</target>
diff --git a/summarize.xsl b/summarize.xsl
index 78f89fd..b4e6375 100644
--- a/summarize.xsl
+++ b/summarize.xsl
@@ -11,6 +11,42 @@
indent="no"
/>
+<xsl:template match="task[@result = 'error']">
+ <xsl:text>&#xa;Error #</xsl:text>
+ <xsl:value-of select="position()"/>
+ <xsl:text>: </xsl:text>
+
+ <xsl:choose>
+ <xsl:when test="@type = 'generate'">
+ <xsl:for-each select="subtask[@result = 'error']">
+ <xsl:text>Generation of "</xsl:text>
+ <xsl:value-of select="target"/>
+ <xsl:text>" failed.</xsl:text>
+
+ <xsl:for-each select="log/error">
+ <xsl:text>&#xa;</xsl:text>
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@type = 'link'">
+ <xsl:text>Link from "</xsl:text>
+ <xsl:value-of select="from"/>
+ <xsl:text>" to "</xsl:text>
+ <xsl:value-of select="to"/>
+ <xsl:text>" failed.</xsl:text>
+ </xsl:when>
+ <xsl:when test="@type = 'clean'">
+ <xsl:text>Cleaning of "</xsl:text>
+ <xsl:value-of select="path"/>
+ <xsl:text>" failed.</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="datasource">
<xsl:variable name="total_count" select="count(task)"/>
<xsl:variable name="success_count" select="count(task[@result = 'success'])"/>
@@ -32,6 +68,8 @@
</xsl:otherwise>
</xsl:choose>
<xsl:text>.&#xa;</xsl:text>
+
+ <xsl:apply-templates select="task[@result = 'error']"/>
</xsl:template>
</xsl:stylesheet>