1
<?xml version="1.0" encoding="utf-8"?>
4
# Copyright (C) 2006 Daniel Berrange
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23
<xsl:output method="html"/>
25
<xsl:template match="coverage">
28
<title>Coverage report</title>
29
<style type="text/css">
30
tbody tr.odd td.label {
31
border-top: 1px solid rgb(128,128,128);
32
border-bottom: 1px solid rgb(128,128,128);
34
tbody tr.odd td.label {
35
background: rgb(200,200,200);
39
background: rgb(60,60,60);
45
background: rgb(0,255,0);
49
background: rgb(140,255,140);
53
background: rgb(160,255,0);
57
background: rgb(255,160,0);
61
background: rgb(255,140,140);
65
background: rgb(255,0,0);
71
<h1>Coverage report</h1>
72
<xsl:apply-templates/>
77
<xsl:template match="functions">
78
<h2>Function coverage</h2>
79
<xsl:call-template name="content">
80
<xsl:with-param name="type" select="'function'"/>
85
<xsl:template match="files">
86
<h2>File coverage</h2>
87
<xsl:call-template name="content">
88
<xsl:with-param name="type" select="'file'"/>
92
<xsl:template name="content">
93
<xsl:param name="type"/>
105
<xsl:for-each select="entry">
106
<xsl:call-template name="entry">
107
<xsl:with-param name="type" select="$type"/>
108
<xsl:with-param name="class">
110
<xsl:when test="position() mod 2">
111
<xsl:text>odd</xsl:text>
114
<xsl:text>even</xsl:text>
122
<xsl:for-each select="summary">
123
<xsl:call-template name="entry">
124
<xsl:with-param name="type" select="'summary'"/>
125
<xsl:with-param name="class">
127
<xsl:when test="position() mod 2">
128
<xsl:text>odd</xsl:text>
131
<xsl:text>even</xsl:text>
141
<xsl:template name="entry">
142
<xsl:param name="type"/>
143
<xsl:param name="class"/>
144
<tr class="{$class}">
146
<xsl:when test="$type = 'function'">
147
<td class="label"><a href="{@details}.html#{@name}"><xsl:value-of select="@name"/></a></td>
149
<xsl:when test="$type = 'file'">
150
<td class="label"><a href="{@details}.html"><xsl:value-of select="@name"/></a></td>
153
<td class="label">Summary</td>
157
<xsl:if test="count(lines)">
158
<xsl:apply-templates select="lines"/>
160
<xsl:if test="not(count(lines))">
161
<xsl:call-template name="missing"/>
164
<xsl:if test="count(branches)">
165
<xsl:apply-templates select="branches"/>
167
<xsl:if test="not(count(branches))">
168
<xsl:call-template name="missing"/>
171
<xsl:if test="count(conditions)">
172
<xsl:apply-templates select="conditions"/>
174
<xsl:if test="not(count(conditions))">
175
<xsl:call-template name="missing"/>
178
<xsl:if test="count(calls)">
179
<xsl:apply-templates select="calls"/>
181
<xsl:if test="not(count(calls))">
182
<xsl:call-template name="missing"/>
188
<xsl:template match="lines">
189
<xsl:call-template name="row"/>
192
<xsl:template match="branches">
193
<xsl:call-template name="row"/>
196
<xsl:template match="conditions">
197
<xsl:call-template name="row"/>
200
<xsl:template match="calls">
201
<xsl:call-template name="row"/>
204
<xsl:template name="missing">
208
<xsl:template name="row">
209
<xsl:variable name="quality">
211
<xsl:when test="@coverage = 100">
212
<xsl:text>perfect</xsl:text>
214
<xsl:when test="@coverage >= 80.0">
215
<xsl:text>excellant</xsl:text>
217
<xsl:when test="@coverage >= 60.0">
218
<xsl:text>good</xsl:text>
220
<xsl:when test="@coverage >= 40.0">
221
<xsl:text>poor</xsl:text>
223
<xsl:when test="@coverage >= 20.0">
224
<xsl:text>bad</xsl:text>
227
<xsl:text>terrible</xsl:text>
232
<td class="{$quality}"><xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/></td>