common/tools/brag/brag.xsl
author Maciej Seroka <maciejs@symbian.org>
Fri, 02 Oct 2009 12:09:35 +0100
changeset 567 515ee4687300
parent 557 c6145fb2403d
child 569 5af7cc0d44a1
permissions -rw-r--r--
Device NAME removed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     1
<xsl:stylesheet version="1.0"
557
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     2
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions">
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     3
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     4
<!-- Initialise keys (sort of like hashes?) to enable us to list distinct packages/severities -->
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     5
<xsl:key name="packages" match="stage/step/failures/failure" use="@package"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     6
<xsl:key name="severities" match="stage/step/failures" use="@severity"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     7
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
     8
<!-- Main template -->
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     9
<xsl:template match="/">
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    10
	<html>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    11
	<head><title>Build Status</title></head>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    12
	<body>
557
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    13
	<h1>Build Status</h1>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    14
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    15
	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    16
	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    17
	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    18
	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    19
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    20
	<h2>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    21
	Overall BRAG staus: 
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    22
	<xsl:choose>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    23
		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    24
		<xsl:when test="$majorCount != 0">RED</xsl:when>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    25
		<xsl:when test="$minorCount != 0">AMBER</xsl:when>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    26
		<xsl:when test="$unknownCount != 0">GREEN</xsl:when>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    27
		<xsl:otherwise>GOLD!</xsl:otherwise>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    28
	</xsl:choose>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    29
	</h2>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    30
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    31
	<h2>Breakdown by severity</h2>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    32
	<table border="1">
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    33
	<tr><td>Critical</td><td><xsl:value-of select="$criticalCount"/></td></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    34
	<tr><td>Major</td><td><xsl:value-of select="$majorCount"/></td></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    35
	<tr><td>Minor</td><td><xsl:value-of select="$minorCount"/></td></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    36
	<tr><td>Unknown</td><td><xsl:value-of select="$unknownCount"/></td></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    37
	<tr><th>Grand total</th><th><xsl:value-of select="count(stage/step/failures/failure)"/></th></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    38
	</table>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    39
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    40
	<h2>Breakdown by stage/step</h2>
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    41
	<table border="1">
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    42
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    43
	<xsl:for-each select="stage">
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    44
		<tr>
557
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    45
		<th colspan='2'>Stage: <xsl:value-of select="@name"/></th>
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
		</tr>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    47
		<xsl:for-each select="step">
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
			<tr>
557
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    49
			<td colspan='2'>Step: <xsl:value-of select="@name"/></td>
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    50
			</tr>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    51
			<xsl:for-each select="failures">
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    52
				<tr>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    53
				<td>Failures: <xsl:value-of select="@level"/></td>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    54
				<td>Number: <xsl:value-of select="count(failure)"/></td>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    55
				</tr>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    56
			</xsl:for-each>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    57
		</xsl:for-each>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    58
	</xsl:for-each>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    59
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    60
	</table>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    61
557
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    62
	<!-- If any failures are tied to a specific package... -->
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    63
	<xsl:if test="stage/step/failures/failure[@package]">
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    64
		<h2>Breakdown by package</h2>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    65
		<table border="1">
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    66
		<tr><th>Package</th><th>Total failures</th></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    67
		<!-- Use the Muenchian Method to get a set of distinct packages -->
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    68
		<xsl:for-each select="stage/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]">
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    69
			<xsl:sort select="@package"/>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    70
			<tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    71
		</xsl:for-each>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    72
		</table>
c6145fb2403d Reordered output, so information is presented in a high-level -> low-level way
Simon Howkins <simonh@symbian.org>
parents: 547
diff changeset
    73
	</xsl:if>
547
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    74
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    75
	</body>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    76
	</html>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    77
</xsl:template>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    78
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    79
</xsl:stylesheet>
19f9d5fc6406 Added really basic failure extraction and BRAG calculation to build.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    80