aboutsummaryrefslogtreecommitdiff
path: root/src/steps/summarize.xsl
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-12 12:42:11 +0200
committerAdrian Kummerlaender2014-10-12 12:42:11 +0200
commitbd072c48f380aaf25756c72e2d2ed2474ae9e96d (patch)
tree4b08d282395d51049d35b5a2fd118a8ae5288a8c /src/steps/summarize.xsl
downloadStaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar.gz
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar.bz2
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar.lz
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar.xz
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.tar.zst
StaticXSLT-bd072c48f380aaf25756c72e2d2ed2474ae9e96d.zip
Extracted the static site generation framework into BuildXSLT module
* i.e. the `detail` transformation chain of [blog.kummerlaender.eu](https://github.com/KnairdA/blog.kummerlaender.eu/) * added module defintion file `StaticXSLT.xml` * revamped documentation accordingly * added MIT license
Diffstat (limited to 'src/steps/summarize.xsl')
-rw-r--r--src/steps/summarize.xsl75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/steps/summarize.xsl b/src/steps/summarize.xsl
new file mode 100644
index 0000000..0399507
--- /dev/null
+++ b/src/steps/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="text"
+ 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>