common/tools/brag/brag.xsl
changeset 557 c6145fb2403d
parent 547 19f9d5fc6406
child 569 5af7cc0d44a1
equal deleted inserted replaced
556:fa2414b24dc4 557:c6145fb2403d
     1 <xsl:stylesheet version="1.0"
     1 <xsl:stylesheet version="1.0"
     2 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     2 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions">
     3 	xmlns:fn="http://www.w3.org/2005/xpath-functions"
     3 
     4 	>
     4 <!-- Initialise keys (sort of like hashes?) to enable us to list distinct packages/severities -->
       
     5 <xsl:key name="packages" match="stage/step/failures/failure" use="@package"/>
       
     6 <xsl:key name="severities" match="stage/step/failures" use="@severity"/>
       
     7 
       
     8 <!-- Main template -->
     5 <xsl:template match="/">
     9 <xsl:template match="/">
     6 	<html>
    10 	<html>
     7 	<link href="http://developer.symbian.org/css/reset.css" rel="stylesheet" type="text/css" />
       
     8 	<link href="http://developer.symbian.org/css/portal-merged.css" rel="stylesheet" type="text/css" />
       
     9 	<link href="http://developer.symbian.org/css/iefix.css" rel="stylesheet" type="text/css" />
       
    10 	<head><title>Build Status</title></head>
    11 	<head><title>Build Status</title></head>
    11 	<body>
    12 	<body>
    12 	<h2>Build Status</h2>
    13 	<h1>Build Status</h1>
       
    14 
       
    15 	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
       
    16 	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
       
    17 	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
       
    18 	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
       
    19 
       
    20 	<h2>
       
    21 	Overall BRAG staus: 
       
    22 	<xsl:choose>
       
    23 		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
       
    24 		<xsl:when test="$majorCount != 0">RED</xsl:when>
       
    25 		<xsl:when test="$minorCount != 0">AMBER</xsl:when>
       
    26 		<xsl:when test="$unknownCount != 0">GREEN</xsl:when>
       
    27 		<xsl:otherwise>GOLD!</xsl:otherwise>
       
    28 	</xsl:choose>
       
    29 	</h2>
       
    30 
       
    31 	<h2>Breakdown by severity</h2>
       
    32 	<table border="1">
       
    33 	<tr><td>Critical</td><td><xsl:value-of select="$criticalCount"/></td></tr>
       
    34 	<tr><td>Major</td><td><xsl:value-of select="$majorCount"/></td></tr>
       
    35 	<tr><td>Minor</td><td><xsl:value-of select="$minorCount"/></td></tr>
       
    36 	<tr><td>Unknown</td><td><xsl:value-of select="$unknownCount"/></td></tr>
       
    37 	<tr><th>Grand total</th><th><xsl:value-of select="count(stage/step/failures/failure)"/></th></tr>
       
    38 	</table>
       
    39 
       
    40 	<h2>Breakdown by stage/step</h2>
    13 	<table border="1">
    41 	<table border="1">
    14 
    42 
    15 	<xsl:for-each select="stage">
    43 	<xsl:for-each select="stage">
    16 		<tr>
    44 		<tr>
    17 		<th>Stage: <xsl:value-of select="@name"/></th>
    45 		<th colspan='2'>Stage: <xsl:value-of select="@name"/></th>
    18 		</tr>
    46 		</tr>
    19 		<xsl:for-each select="step">
    47 		<xsl:for-each select="step">
    20 			<tr>
    48 			<tr>
    21 			<td>Step: <xsl:value-of select="@name"/></td>
    49 			<td colspan='2'>Step: <xsl:value-of select="@name"/></td>
    22 			</tr>
    50 			</tr>
    23 			<xsl:for-each select="failures">
    51 			<xsl:for-each select="failures">
    24 				<tr>
    52 				<tr>
    25 				<td>Failures: <xsl:value-of select="@level"/></td>
    53 				<td>Failures: <xsl:value-of select="@level"/></td>
    26 				<td>Number: <xsl:value-of select="count(failure)"/></td>
    54 				<td>Number: <xsl:value-of select="count(failure)"/></td>
    29 		</xsl:for-each>
    57 		</xsl:for-each>
    30 	</xsl:for-each>
    58 	</xsl:for-each>
    31 
    59 
    32 	</table>
    60 	</table>
    33 
    61 
    34 	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
    62 	<!-- If any failures are tied to a specific package... -->
    35 	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
    63 	<xsl:if test="stage/step/failures/failure[@package]">
    36 	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
    64 		<h2>Breakdown by package</h2>
    37 	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
    65 		<table border="1">
    38 
    66 		<tr><th>Package</th><th>Total failures</th></tr>
    39 	<p>Total number of critical errors = <xsl:value-of select="$criticalCount"/></p>
    67 		<!-- Use the Muenchian Method to get a set of distinct packages -->
    40 	<p>Total number of major errors = <xsl:value-of select="$majorCount"/></p>
    68 		<xsl:for-each select="stage/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]">
    41 	<p>Total number of minor errors = <xsl:value-of select="$minorCount"/></p>
    69 			<xsl:sort select="@package"/>
    42 	<p>Total number of unknown errors = <xsl:value-of select="$unknownCount"/></p>
    70 			<tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr>
    43 
    71 		</xsl:for-each>
    44 	<h2>
    72 		</table>
    45 	Final BRAG staus: 
    73 	</xsl:if>
    46 	<xsl:choose>
       
    47 		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
       
    48 		<xsl:when test="$majorCount != 0">RED</xsl:when>
       
    49 		<xsl:when test="$minorCount != 0">AMBER</xsl:when>
       
    50 		<xsl:when test="$unknownCount != 0">GREEN</xsl:when>
       
    51 		<xsl:otherwise>GOLD!</xsl:otherwise>
       
    52 	</xsl:choose>
       
    53 	</h2>
       
    54 
    74 
    55 	</body>
    75 	</body>
    56 	</html>
    76 	</html>
    57 </xsl:template>
    77 </xsl:template>
    58 
    78