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="failure" use="@package"/> |
5 <xsl:key name="packages" match="failure" use="@package"/> |
6 <xsl:key name="severities" match="failures" use="@severity"/> |
6 <xsl:key name="severities" match="/buildStatus/phase/step/failures" use="@level"/> |
|
7 <xsl:key name="packageANDseverity" match="/buildStatus/phase/step/failures[@level]/failure[@package]" use="concat(../@level, @package)"/> |
7 |
8 |
8 <!-- Main template --> |
9 <!-- Main template --> |
9 <xsl:template match="/buildStatus"> |
10 <xsl:template match="/buildStatus"> |
10 <html> |
11 <html> |
11 <head><title>Build Status</title></head> |
12 <head><title>Build Status</title></head> |
65 <table border="1"> |
66 <table border="1"> |
66 <tr><th>Package</th><th>Total failures</th></tr> |
67 <tr><th>Package</th><th>Total failures</th></tr> |
67 <!-- Use the Muenchian Method to get a set of distinct packages --> |
68 <!-- Use the Muenchian Method to get a set of distinct packages --> |
68 <xsl:for-each select="phase/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]"> |
69 <xsl:for-each select="phase/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]"> |
69 <xsl:sort select="@package"/> |
70 <xsl:sort select="@package"/> |
70 <tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr> |
71 <tr> |
|
72 <td><a><xsl:attribute name="href"><xsl:value-of select="concat('#package', @package)"/></xsl:attribute><xsl:value-of select="@package"/></a></td> |
|
73 <td><xsl:value-of select="count(key('packages', @package))"/></td> |
|
74 </tr> |
71 </xsl:for-each> |
75 </xsl:for-each> |
72 </table> |
76 </table> |
|
77 |
|
78 <h2>Breakdown by package/severity</h2> |
|
79 <xsl:for-each select="phase/step/failures[@level]/failure[generate-id(.) = generate-id(key('packages', @package))]"> |
|
80 <xsl:sort select="@package"/> |
|
81 <xsl:variable name="package" select="@package"/> |
|
82 <xsl:element name="a"> |
|
83 </xsl:element> |
|
84 <a><xsl:attribute name="name"><xsl:value-of select="concat('package', $package)"/></xsl:attribute> |
|
85 <h3><xsl:value-of select="$package"/></h3> |
|
86 </a> |
|
87 <table border="1"> |
|
88 <tr><th>Severity</th><th>Count</th></tr> |
|
89 <xsl:for-each select="/buildStatus/phase/step/failures[generate-id(.) = generate-id(key('severities', @level))]"> |
|
90 <xsl:variable name="severity" select="@level"/> |
|
91 <tr> |
|
92 <td><xsl:value-of select="$severity"/></td> |
|
93 <td><xsl:value-of select="count(key('packageANDseverity', concat($severity, $package)))"/></td> |
|
94 </tr> |
|
95 </xsl:for-each> |
|
96 </table> |
|
97 </xsl:for-each> |
73 </xsl:if> |
98 </xsl:if> |
74 |
99 |
75 </body> |
100 </body> |
76 </html> |
101 </html> |
77 </xsl:template> |
102 </xsl:template> |