diff options
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.xsl | 18 | ||||
-rw-r--r-- | summarize.xsl | 38 |
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>
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>
</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>.
</xsl:text> + + <xsl:apply-templates select="task[@result = 'error']"/> </xsl:template> </xsl:stylesheet> |