New XSL rules to generate a diamonds compatible BRAG status, which can be posted into the database.
authorSimon Howkins <simonh@symbian.org>
Mon, 05 Oct 2009 13:40:29 +0100
changeset 581 46df4556c7d9
parent 580 0a42a7ed6d8d
child 583 afb8726c3275
New XSL rules to generate a diamonds compatible BRAG status, which can be posted into the database.
common/tools/brag/bragForDiamonds.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/brag/bragForDiamonds.xsl	Mon Oct 05 13:40:29 2009 +0100
@@ -0,0 +1,26 @@
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- Main template -->
+<xsl:template match="/buildStatus">
+	<xsl:variable name="criticalCount" select="count(phase/step/failures[@level='critical']/failure)"/>
+	<xsl:variable name="majorCount" select="count(phase/step/failures[@level='major']/failure)"/>
+	<xsl:variable name="minorCount" select="count(phase/step/failures[@level='minor']/failure)"/>
+	<xsl:variable name="unknownCount" select="count(phase/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
+
+	<diamonds-build>
+	<build>
+	<status>
+	<xsl:choose>
+		<xsl:when test="$criticalCount != 0">Black</xsl:when>
+		<xsl:when test="$majorCount != 0">Red</xsl:when>
+		<xsl:when test="$minorCount != 0">Amber</xsl:when>
+		<xsl:when test="$unknownCount != 0">Green</xsl:when>
+		<xsl:otherwise>Gold</xsl:otherwise>
+	</xsl:choose>
+	</status>
+	</build>
+	</diamonds-build>
+</xsl:template>
+
+</xsl:stylesheet>
+