aboutsummaryrefslogtreecommitdiff
path: root/detail/summarize.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/summarize.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/summarize.xsl')
-rw-r--r--detail/summarize.xsl75
1 files changed, 75 insertions, 0 deletions
diff --git a/detail/summarize.xsl b/detail/summarize.xsl
new file mode 100644
index 0000000..b4e6375
--- /dev/null
+++ b/detail/summarize.xsl
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="yes"
+ encoding="UTF-8"
+ 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'])"/>
+
+ <xsl:text>Tasks processed: </xsl:text>
+ <xsl:value-of select="$total_count"/>
+ <xsl:text>&#xa;</xsl:text>
+ <xsl:text>Tasks successful: </xsl:text>
+ <xsl:value-of select="$success_count"/>
+ <xsl:text>&#xa;</xsl:text>
+
+ <xsl:text>▶ Generation </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$total_count = $success_count">
+ <xsl:text>successful</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>failed</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>.&#xa;</xsl:text>
+
+ <xsl:apply-templates select="task[@result = 'error']"/>
+</xsl:template>
+
+</xsl:stylesheet>