common/tools/brag/brag.xsl
changeset 569 5af7cc0d44a1
parent 557 c6145fb2403d
child 606 7441b114b8c8
equal deleted inserted replaced
568:a1d3b0c3227b 569:5af7cc0d44a1
     1 <xsl:stylesheet version="1.0"
     1 <xsl:stylesheet version="1.0"
     2 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions">
     2 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions">
     3 
     3 
     4 <!-- Initialise keys (sort of like hashes?) to enable us to list distinct packages/severities -->
     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"/>
     5 <xsl:key name="packages" match="failure" use="@package"/>
     6 <xsl:key name="severities" match="stage/step/failures" use="@severity"/>
     6 <xsl:key name="severities" match="failures" use="@severity"/>
     7 
     7 
     8 <!-- Main template -->
     8 <!-- Main template -->
     9 <xsl:template match="/">
     9 <xsl:template match="/buildStatus">
    10 	<html>
    10 	<html>
    11 	<head><title>Build Status</title></head>
    11 	<head><title>Build Status</title></head>
    12 	<body>
    12 	<body>
    13 	<h1>Build Status</h1>
    13 	<h1>Build Status</h1>
    14 
    14 
    15 	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
    15 	<xsl:variable name="criticalCount" select="count(phase/step/failures[@level='critical']/failure)"/>
    16 	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
    16 	<xsl:variable name="majorCount" select="count(phase/step/failures[@level='major']/failure)"/>
    17 	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
    17 	<xsl:variable name="minorCount" select="count(phase/step/failures[@level='minor']/failure)"/>
    18 	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
    18 	<xsl:variable name="unknownCount" select="count(phase/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
    19 
    19 
    20 	<h2>
    20 	<h2>
    21 	Overall BRAG staus: 
    21 	Overall BRAG staus: 
    22 	<xsl:choose>
    22 	<xsl:choose>
    23 		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
    23 		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
    32 	<table border="1">
    32 	<table border="1">
    33 	<tr><td>Critical</td><td><xsl:value-of select="$criticalCount"/></td></tr>
    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>
    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>
    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>
    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>
    37 	<tr><th>Grand total</th><th><xsl:value-of select="count(phase/step/failures/failure)"/></th></tr>
    38 	</table>
    38 	</table>
    39 
    39 
    40 	<h2>Breakdown by stage/step</h2>
    40 	<h2>Breakdown by phase/step</h2>
    41 	<table border="1">
    41 	<table border="1">
    42 
    42 
    43 	<xsl:for-each select="stage">
    43 	<xsl:for-each select="phase">
    44 		<tr>
    44 		<tr>
    45 		<th colspan='2'>Stage: <xsl:value-of select="@name"/></th>
    45 		<th colspan='2'>Phase: <xsl:value-of select="@name"/></th>
    46 		</tr>
    46 		</tr>
    47 		<xsl:for-each select="step">
    47 		<xsl:for-each select="step">
    48 			<tr>
    48 			<tr>
    49 			<td colspan='2'>Step: <xsl:value-of select="@name"/></td>
    49 			<td colspan='2'>Step: <xsl:value-of select="@name"/></td>
    50 			</tr>
    50 			</tr>
    58 	</xsl:for-each>
    58 	</xsl:for-each>
    59 
    59 
    60 	</table>
    60 	</table>
    61 
    61 
    62 	<!-- If any failures are tied to a specific package... -->
    62 	<!-- If any failures are tied to a specific package... -->
    63 	<xsl:if test="stage/step/failures/failure[@package]">
    63 	<xsl:if test="phase/step/failures/failure[@package]">
    64 		<h2>Breakdown by package</h2>
    64 		<h2>Breakdown by package</h2>
    65 		<table border="1">
    65 		<table border="1">
    66 		<tr><th>Package</th><th>Total failures</th></tr>
    66 		<tr><th>Package</th><th>Total failures</th></tr>
    67 		<!-- Use the Muenchian Method to get a set of distinct packages -->
    67 		<!-- Use the Muenchian Method to get a set of distinct packages -->
    68 		<xsl:for-each select="stage/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]">
    68 		<xsl:for-each select="phase/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]">
    69 			<xsl:sort select="@package"/>
    69 			<xsl:sort select="@package"/>
    70 			<tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr>
    70 			<tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr>
    71 		</xsl:for-each>
    71 		</xsl:for-each>
    72 		</table>
    72 		</table>
    73 	</xsl:if>
    73 	</xsl:if>