| 1 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" |
|---|
| 2 |
xmlns:exsl="http://exslt.org/common" |
|---|
| 3 |
xmlns:date="http://exslt.org/dates-and-times" |
|---|
| 4 |
extension-element-prefixes="exsl date"> |
|---|
| 5 |
<xsl:output method="html" indent="yes"/> |
|---|
| 6 |
<xsl:decimal-format decimal-separator="." grouping-separator="," /> |
|---|
| 7 |
<!-- |
|---|
| 8 |
Copyright 2001-2004 The Apache Software Foundation |
|---|
| 9 |
|
|---|
| 10 |
Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 11 |
you may not use this file except in compliance with the License. |
|---|
| 12 |
You may obtain a copy of the License at |
|---|
| 13 |
|
|---|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 15 |
|
|---|
| 16 |
Unless required by applicable law or agreed to in writing, software |
|---|
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 19 |
See the License for the specific language governing permissions and |
|---|
| 20 |
limitations under the License. |
|---|
| 21 |
|
|---|
| 22 |
--> |
|---|
| 23 |
|
|---|
| 24 |
<!-- |
|---|
| 25 |
|
|---|
| 26 |
Sample stylesheet to be used with Xdebug/Phing code coverage output. |
|---|
| 27 |
Based on JProbe stylesheets from Apache Ant. |
|---|
| 28 |
|
|---|
| 29 |
It creates a set of HTML files a la javadoc where you can browse easily |
|---|
| 30 |
through all packages and classes. |
|---|
| 31 |
|
|---|
| 32 |
@author Michiel Rook <a href="mailto:michiel.rook@gmail.com"/> |
|---|
| 33 |
@author Stephane Bailliez <a href="mailto:sbailliez@apache.org"/> |
|---|
| 34 |
|
|---|
| 35 |
--> |
|---|
| 36 |
|
|---|
| 37 |
<!-- default output directory is current directory --> |
|---|
| 38 |
<xsl:param name="output.dir" select="'.'"/> |
|---|
| 39 |
|
|---|
| 40 |
<!-- ====================================================================== |
|---|
| 41 |
Root element |
|---|
| 42 |
======================================================================= --> |
|---|
| 43 |
<xsl:template match="/snapshot"> |
|---|
| 44 |
<!-- create the index.html --> |
|---|
| 45 |
<exsl:document href="efile://{$output.dir}/index.html"> |
|---|
| 46 |
<xsl:call-template name="index.html"/> |
|---|
| 47 |
</exsl:document> |
|---|
| 48 |
|
|---|
| 49 |
<!-- create the stylesheet.css --> |
|---|
| 50 |
<exsl:document href="efile://{$output.dir}/stylesheet.css"> |
|---|
| 51 |
<xsl:call-template name="stylesheet.css"/> |
|---|
| 52 |
</exsl:document> |
|---|
| 53 |
|
|---|
| 54 |
<!-- create the overview-packages.html at the root --> |
|---|
| 55 |
<exsl:document href="efile://{$output.dir}/overview-summary.html"> |
|---|
| 56 |
<xsl:apply-templates select="." mode="overview.packages"/> |
|---|
| 57 |
</exsl:document> |
|---|
| 58 |
|
|---|
| 59 |
<!-- create the all-packages.html at the root --> |
|---|
| 60 |
<exsl:document href="efile://{$output.dir}/overview-frame.html"> |
|---|
| 61 |
<xsl:apply-templates select="." mode="all.packages"/> |
|---|
| 62 |
</exsl:document> |
|---|
| 63 |
|
|---|
| 64 |
<!-- create the all-classes.html at the root --> |
|---|
| 65 |
<exsl:document href="efile://{$output.dir}/allclasses-frame.html"> |
|---|
| 66 |
<xsl:apply-templates select="." mode="all.classes"/> |
|---|
| 67 |
</exsl:document> |
|---|
| 68 |
|
|---|
| 69 |
<!-- process all packages --> |
|---|
| 70 |
<xsl:apply-templates select="./package" mode="write"/> |
|---|
| 71 |
</xsl:template> |
|---|
| 72 |
|
|---|
| 73 |
<!-- ======================================================================= |
|---|
| 74 |
Frameset definition. Entry point for the report. |
|---|
| 75 |
3 frames: packageListFrame, classListFrame, classFrame |
|---|
| 76 |
======================================================================= --> |
|---|
| 77 |
<xsl:template name="index.html"> |
|---|
| 78 |
<html> |
|---|
| 79 |
<head><title>Coverage Results.</title></head> |
|---|
| 80 |
<frameset cols="20%,80%"> |
|---|
| 81 |
<frameset rows="30%,70%"> |
|---|
| 82 |
<frame src="overview-frame.html" name="packageListFrame"/> |
|---|
| 83 |
<frame src="allclasses-frame.html" name="classListFrame"/> |
|---|
| 84 |
</frameset> |
|---|
| 85 |
<frame src="overview-summary.html" name="classFrame"/> |
|---|
| 86 |
</frameset> |
|---|
| 87 |
<noframes> |
|---|
| 88 |
<h2>Frame Alert</h2> |
|---|
| 89 |
<p> |
|---|
| 90 |
This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. |
|---|
| 91 |
</p> |
|---|
| 92 |
</noframes> |
|---|
| 93 |
</html> |
|---|
| 94 |
</xsl:template> |
|---|
| 95 |
|
|---|
| 96 |
<!-- ======================================================================= |
|---|
| 97 |
Stylesheet CSS used |
|---|
| 98 |
======================================================================= --> |
|---|
| 99 |
<!-- this is the stylesheet css to use for nearly everything --> |
|---|
| 100 |
<xsl:template name="stylesheet.css"> |
|---|
| 101 |
.bannercell { |
|---|
| 102 |
border: 0px; |
|---|
| 103 |
padding: 0px; |
|---|
| 104 |
} |
|---|
| 105 |
body { |
|---|
| 106 |
margin-left: 10; |
|---|
| 107 |
margin-right: 10; |
|---|
| 108 |
background-color:#FFFFFF; |
|---|
| 109 |
font-family: verdana,arial,sanserif; |
|---|
| 110 |
color:#000000; |
|---|
| 111 |
} |
|---|
| 112 |
a { |
|---|
| 113 |
color: #003399; |
|---|
| 114 |
} |
|---|
| 115 |
a:hover { |
|---|
| 116 |
color: #888888; |
|---|
| 117 |
} |
|---|
| 118 |
.a td { |
|---|
| 119 |
background: #efefef; |
|---|
| 120 |
} |
|---|
| 121 |
.b td { |
|---|
| 122 |
background: #fff; |
|---|
| 123 |
} |
|---|
| 124 |
th, td { |
|---|
| 125 |
text-align: left; |
|---|
| 126 |
vertical-align: top; |
|---|
| 127 |
} |
|---|
| 128 |
th { |
|---|
| 129 |
font-weight:bold; |
|---|
| 130 |
background: #ccc; |
|---|
| 131 |
color: black; |
|---|
| 132 |
} |
|---|
| 133 |
table, th, td { |
|---|
| 134 |
font-size: 12px; |
|---|
| 135 |
border: none |
|---|
| 136 |
} |
|---|
| 137 |
table.log tr td, tr th { |
|---|
| 138 |
} |
|---|
| 139 |
h2 { |
|---|
| 140 |
font-weight:bold; |
|---|
| 141 |
font-size: 12px; |
|---|
| 142 |
margin-bottom: 5; |
|---|
| 143 |
} |
|---|
| 144 |
h3 { |
|---|
| 145 |
font-size:100%; |
|---|
| 146 |
font-weight: 12px; |
|---|
| 147 |
background: #DFDFDF |
|---|
| 148 |
color: white; |
|---|
| 149 |
text-decoration: none; |
|---|
| 150 |
padding: 5px; |
|---|
| 151 |
margin-right: 2px; |
|---|
| 152 |
margin-left: 2px; |
|---|
| 153 |
margin-bottom: 0; |
|---|
| 154 |
} |
|---|
| 155 |
.small { |
|---|
| 156 |
font-size: 9px; |
|---|
| 157 |
} |
|---|
| 158 |
TD.empty { |
|---|
| 159 |
FONT-SIZE: 2px; BACKGROUND: #c0c0c0; BORDER:#9c9c9c 1px solid; |
|---|
| 160 |
color: #c0c0c0; |
|---|
| 161 |
} |
|---|
| 162 |
TD.fullcover { |
|---|
| 163 |
FONT-SIZE: 2px; BACKGROUND: #00df00; BORDER:#9c9c9c 1px solid; |
|---|
| 164 |
color: #00df00; |
|---|
| 165 |
} |
|---|
| 166 |
TD.covered { |
|---|
| 167 |
FONT-SIZE: 2px; BACKGROUND: #00df00; BORDER-LEFT:#9c9c9c 1px solid;BORDER-TOP:#9c9c9c 1px solid;BORDER-BOTTOM:#9c9c9c 1px solid; |
|---|
| 168 |
color: #00df00; |
|---|
| 169 |
} |
|---|
| 170 |
TD.uncovered { |
|---|
| 171 |
FONT-SIZE: 2px; BACKGROUND: #df0000; BORDER:#9c9c9c 1px solid; |
|---|
| 172 |
color: #df0000; |
|---|
| 173 |
} |
|---|
| 174 |
PRE.srcLine { |
|---|
| 175 |
BACKGROUND: #ffffff; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; |
|---|
| 176 |
} |
|---|
| 177 |
td.lineCount, td.coverageCount { |
|---|
| 178 |
BACKGROUND: #F0F0F0; PADDING-RIGHT: 3px; |
|---|
| 179 |
text-align: right; |
|---|
| 180 |
} |
|---|
| 181 |
td.lineCountHighlight { |
|---|
| 182 |
background: #C8C8F0; PADDING-RIGHT: 3px; |
|---|
| 183 |
text-align: right; |
|---|
| 184 |
} |
|---|
| 185 |
td.coverageCountHighlight { |
|---|
| 186 |
background: #F0C8C8; PADDING-RIGHT: 3px; |
|---|
| 187 |
text-align: right; |
|---|
| 188 |
} |
|---|
| 189 |
span.srcLineHighlight { |
|---|
| 190 |
background: #F0C8C8; |
|---|
| 191 |
} |
|---|
| 192 |
span.srcLine { |
|---|
| 193 |
background: #C8C8F0; |
|---|
| 194 |
} |
|---|
| 195 |
TD.srcLineClassStart { |
|---|
| 196 |
WIDTH: 100%; BORDER-TOP:#dcdcdc 1px solid; FONT-WEIGHT: bold; |
|---|
| 197 |
} |
|---|
| 198 |
.srcLine , .srcLine ol, .srcLine ol li {margin: 0;} |
|---|
| 199 |
.srcLine .de1, .srcLine .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} |
|---|
| 200 |
.srcLine .imp {font-weight: bold; color: red;} |
|---|
| 201 |
.srcLine .kw1 {color: #b1b100;} |
|---|
| 202 |
.srcLine .kw2 {color: #000000; font-weight: bold;} |
|---|
| 203 |
.srcLine .kw3 {color: #000066;} |
|---|
| 204 |
.srcLine .co1 {color: #808080; font-style: italic;} |
|---|
| 205 |
.srcLine .co2 {color: #808080; font-style: italic;} |
|---|
| 206 |
.srcLine .coMULTI {color: #808080; font-style: italic;} |
|---|
| 207 |
.srcLine .es0 {color: #000099; font-weight: bold;} |
|---|
| 208 |
.srcLine .br0 {color: #66cc66;} |
|---|
| 209 |
.srcLine .st0 {color: #ff0000;} |
|---|
| 210 |
.srcLine .nu0 {color: #cc66cc;} |
|---|
| 211 |
.srcLine .me1 {color: #006600;} |
|---|
| 212 |
.srcLine .me2 {color: #006600;} |
|---|
| 213 |
.srcLine .re0 {color: #0000ff;} |
|---|
| 214 |
</xsl:template> |
|---|
| 215 |
|
|---|
| 216 |
<!-- ======================================================================= |
|---|
| 217 |
List of all classes in all packages |
|---|
| 218 |
This will be the first page in the classListFrame |
|---|
| 219 |
======================================================================= --> |
|---|
| 220 |
<xsl:template match="snapshot" mode="all.classes"> |
|---|
| 221 |
<html> |
|---|
| 222 |
<head> |
|---|
| 223 |
<xsl:call-template name="create.stylesheet.link"/> |
|---|
| 224 |
</head> |
|---|
| 225 |
<body> |
|---|
| 226 |
<h2>All Classes</h2> |
|---|
| 227 |
<table width="100%"> |
|---|
| 228 |
<xsl:for-each select="package/class"> |
|---|
| 229 |
<xsl:sort select="@name"/> |
|---|
| 230 |
<xsl:variable name="package.name" select="(ancestor::package)[last()]/@name"/> |
|---|
| 231 |
<xsl:variable name="link"> |
|---|
| 232 |
<xsl:if test="not($package.name='')"> |
|---|
| 233 |
<xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text> |
|---|
| 234 |
</xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text> |
|---|
| 235 |
</xsl:variable> |
|---|
| 236 |
<tr> |
|---|
| 237 |
<td nowrap="nowrap"> |
|---|
| 238 |
<a target="classFrame" href="{$link}"><xsl:value-of select="@name"/></a> |
|---|
| 239 |
<xsl:choose> |
|---|
| 240 |
<xsl:when test="@totalcount=0"> |
|---|
| 241 |
<i> (-)</i> |
|---|
| 242 |
</xsl:when> |
|---|
| 243 |
<xsl:otherwise> |
|---|
| 244 |
<i> (<xsl:value-of select="format-number(@totalcovered div @totalcount, '0.0%')"/>)</i> |
|---|
| 245 |
</xsl:otherwise> |
|---|
| 246 |
</xsl:choose> |
|---|
| 247 |
</td> |
|---|
| 248 |
</tr> |
|---|
| 249 |
</xsl:for-each> |
|---|
| 250 |
</table> |
|---|
| 251 |
</body> |
|---|
| 252 |
</html> |
|---|
| 253 |
</xsl:template> |
|---|
| 254 |
|
|---|
| 255 |
<!-- list of all packages --> |
|---|
| 256 |
<xsl:template match="snapshot" mode="all.packages"> |
|---|
| 257 |
<html> |
|---|
| 258 |
<head> |
|---|
| 259 |
<xsl:call-template name="create.stylesheet.link"/> |
|---|
| 260 |
</head> |
|---|
| 261 |
<body> |
|---|
| 262 |
<h2><a href="overview-summary.html" target="classFrame">Overview</a></h2> |
|---|
| 263 |
<h2>All Packages</h2> |
|---|
| 264 |
<table width="100%"> |
|---|
| 265 |
<xsl:for-each select="package"> |
|---|
| 266 |
<xsl:sort select="@name" order="ascending"/> |
|---|
| 267 |
<tr> |
|---|
| 268 |
<td nowrap="nowrap"> |
|---|
| 269 |
<a href="{translate(@name,'.','/')}/package-summary.html" target="classFrame"> |
|---|
| 270 |
<xsl:value-of select="@name"/> |
|---|
| 271 |
</a> |
|---|
| 272 |
</td> |
|---|
| 273 |
</tr> |
|---|
| 274 |
</xsl:for-each> |
|---|
| 275 |
</table> |
|---|
| 276 |
</body> |
|---|
| 277 |
</html> |
|---|
| 278 |
</xsl:template> |
|---|
| 279 |
|
|---|
| 280 |
<!-- overview of statistics in packages --> |
|---|
| 281 |
<xsl:template match="snapshot" mode="overview.packages"> |
|---|
| 282 |
<html> |
|---|
| 283 |
<head> |
|---|
| 284 |
<xsl:call-template name="create.stylesheet.link"/> |
|---|
| 285 |
</head> |
|---|
| 286 |
<body onload="open('allclasses-frame.html','classListFrame')"> |
|---|
| 287 |
<xsl:call-template name="pageHeader"/> |
|---|
| 288 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 289 |
<tr class="a"> |
|---|
| 290 |
<td class="small">Packages: <xsl:value-of select="count(package)"/></td> |
|---|
| 291 |
<td class="small">Classes: <xsl:value-of select="count(package/class)"/></td> |
|---|
| 292 |
<td class="small">Methods: <xsl:value-of select="@methodcount"/></td> |
|---|
| 293 |
<td class="small">LOC: <xsl:value-of select="count(package/class/sourcefile/sourceline)"/></td> |
|---|
| 294 |
<td class="small">Statements: <xsl:value-of select="@statementcount"/></td> |
|---|
| 295 |
</tr> |
|---|
| 296 |
</table> |
|---|
| 297 |
<br/> |
|---|
| 298 |
|
|---|
| 299 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 300 |
<tr> |
|---|
| 301 |
<th width="100%" nowrap="nowrap"></th> |
|---|
| 302 |
<th>Statements</th> |
|---|
| 303 |
<th>Methods</th> |
|---|
| 304 |
<th width="350" colspan="2" nowrap="nowrap">Total coverage</th> |
|---|
| 305 |
</tr> |
|---|
| 306 |
<tr class="a"> |
|---|
| 307 |
<td><b>Project</b></td> |
|---|
| 308 |
<xsl:call-template name="stats.formatted"/> |
|---|
| 309 |
</tr> |
|---|
| 310 |
<tr> |
|---|
| 311 |
<td colspan="3"><br/></td> |
|---|
| 312 |
</tr> |
|---|
| 313 |
<tr> |
|---|
| 314 |
<th width="100%">Packages</th> |
|---|
| 315 |
<th>Statements</th> |
|---|
| 316 |
<th>Methods</th> |
|---|
| 317 |
<th width="350" colspan="2" nowrap="nowrap">Total coverage</th> |
|---|
| 318 |
</tr> |
|---|
| 319 |
<!-- display packages and sort them via their coverage rate --> |
|---|
| 320 |
<xsl:for-each select="package"> |
|---|
| 321 |
<xsl:sort data-type="number" select="@totalcovered div @totalcount"/> |
|---|
| 322 |
<tr> |
|---|
| 323 |
<xsl:call-template name="alternate-row"/> |
|---|
| 324 |
<td><a href="{translate(@name,'.','/')}/package-summary.html"><xsl:value-of select="@name"/></a></td> |
|---|
| 325 |
<xsl:call-template name="stats.formatted"/> |
|---|
| 326 |
</tr> |
|---|
| 327 |
</xsl:for-each> |
|---|
| 328 |
</table> |
|---|
| 329 |
<xsl:call-template name="pageFooter"/> |
|---|
| 330 |
</body> |
|---|
| 331 |
</html> |
|---|
| 332 |
</xsl:template> |
|---|
| 333 |
|
|---|
| 334 |
<!-- |
|---|
| 335 |
detailed info for a package. It will output the list of classes |
|---|
| 336 |
, the summary page, and the info for each class |
|---|
| 337 |
--> |
|---|
| 338 |
<xsl:template match="package" mode="write"> |
|---|
| 339 |
<xsl:variable name="package.dir"> |
|---|
| 340 |
<xsl:if test="not(@name = '')"><xsl:value-of select="translate(@name,'.','/')"/></xsl:if> |
|---|
| 341 |
<xsl:if test="@name = ''">.</xsl:if> |
|---|
| 342 |
</xsl:variable> |
|---|
| 343 |
|
|---|
| 344 |
<!-- create a classes-list.html in the package directory --> |
|---|
| 345 |
<exsl:document href="efile://{$output.dir}/{$package.dir}/package-frame.html"> |
|---|
| 346 |
<xsl:apply-templates select="." mode="classes.list"/> |
|---|
| 347 |
</exsl:document> |
|---|
| 348 |
|
|---|
| 349 |
<!-- create a package-summary.html in the package directory --> |
|---|
| 350 |
<exsl:document href="efile://{$output.dir}/{$package.dir}/package-summary.html"> |
|---|
| 351 |
<xsl:apply-templates select="." mode="package.summary"/> |
|---|
| 352 |
</exsl:document> |
|---|
| 353 |
|
|---|
| 354 |
<!-- for each class, creates a @name.html --> |
|---|
| 355 |
<xsl:for-each select="class"> |
|---|
| 356 |
<exsl:document href="efile://{$output.dir}/{$package.dir}/{@name}.html"> |
|---|
| 357 |
<xsl:apply-templates select="." mode="class.details"/> |
|---|
| 358 |
</exsl:document> |
|---|
| 359 |
</xsl:for-each> |
|---|
| 360 |
</xsl:template> |
|---|
| 361 |
|
|---|
| 362 |
<!-- list of classes in a package --> |
|---|
| 363 |
<xsl:template match="package" mode="classes.list"> |
|---|
| 364 |
<html> |
|---|
| 365 |
<HEAD> |
|---|
| 366 |
<xsl:call-template name="create.stylesheet.link"> |
|---|
| 367 |
<xsl:with-param name="package.name" select="@name"/> |
|---|
| 368 |
</xsl:call-template> |
|---|
| 369 |
</HEAD> |
|---|
| 370 |
<BODY> |
|---|
| 371 |
<table width="100%"> |
|---|
| 372 |
<tr> |
|---|
| 373 |
<td nowrap="nowrap"> |
|---|
| 374 |
<H2><a href="package-summary.html" target="classFrame"><xsl:value-of select="@name"/></a></H2> |
|---|
| 375 |
</td> |
|---|
| 376 |
</tr> |
|---|
| 377 |
</table> |
|---|
| 378 |
|
|---|
| 379 |
<H2>Classes</H2> |
|---|
| 380 |
<TABLE WIDTH="100%"> |
|---|
| 381 |
<xsl:for-each select="class"> |
|---|
| 382 |
<xsl:sort select="@name"/> |
|---|
| 383 |
<tr> |
|---|
| 384 |
<td nowrap="nowrap"> |
|---|
| 385 |
<a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a> |
|---|
| 386 |
<xsl:choose> |
|---|
| 387 |
<xsl:when test="@totalcount=0"> |
|---|
| 388 |
<i> (-)</i> |
|---|
| 389 |
</xsl:when> |
|---|
| 390 |
<xsl:otherwise> |
|---|
| 391 |
<i>(<xsl:value-of select="format-number(@totalcovered div @totalcount, '0.0%')"/>)</i> |
|---|
| 392 |
</xsl:otherwise> |
|---|
| 393 |
</xsl:choose> |
|---|
| 394 |
</td> |
|---|
| 395 |
</tr> |
|---|
| 396 |
</xsl:for-each> |
|---|
| 397 |
</TABLE> |
|---|
| 398 |
</BODY> |
|---|
| 399 |
</html> |
|---|
| 400 |
</xsl:template> |
|---|
| 401 |
|
|---|
| 402 |
<!-- summary of a package --> |
|---|
| 403 |
<xsl:template match="package" mode="package.summary"> |
|---|
| 404 |
<HTML> |
|---|
| 405 |
<HEAD> |
|---|
| 406 |
<xsl:call-template name="create.stylesheet.link"> |
|---|
| 407 |
<xsl:with-param name="package.name" select="@name"/> |
|---|
| 408 |
</xsl:call-template> |
|---|
| 409 |
</HEAD> |
|---|
| 410 |
<!-- when loading this package, it will open the classes into the frame --> |
|---|
| 411 |
<BODY onload="open('package-frame.html','classListFrame')"> |
|---|
| 412 |
<xsl:call-template name="pageHeader"/> |
|---|
| 413 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 414 |
<tr class="a"> |
|---|
| 415 |
<td class="small">Classes: <xsl:value-of select="count(class)"/></td> |
|---|
| 416 |
<td class="small">Methods: <xsl:value-of select="@methodcount"/></td> |
|---|
| 417 |
<td class="small">LOC: <xsl:value-of select="count(class/sourcefile/sourceline)"/></td> |
|---|
| 418 |
<td class="small">Statements: <xsl:value-of select="@statementcount"/></td> |
|---|
| 419 |
</tr> |
|---|
| 420 |
</table> |
|---|
| 421 |
<br/> |
|---|
| 422 |
|
|---|
| 423 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 424 |
<tr> |
|---|
| 425 |
<th width="100%">Package</th> |
|---|
| 426 |
<th>Statements</th> |
|---|
| 427 |
<th>Methods</th> |
|---|
| 428 |
<th width="350" colspan="2" nowrap="nowrap">Total coverage</th> |
|---|
| 429 |
</tr> |
|---|
| 430 |
<xsl:apply-templates select="." mode="stats"/> |
|---|
| 431 |
|
|---|
| 432 |
<xsl:if test="count(class) > 0"> |
|---|
| 433 |
<tr> |
|---|
| 434 |
<td colspan="3"><br/></td> |
|---|
| 435 |
</tr> |
|---|
| 436 |
<tr> |
|---|
| 437 |
<th width="100%">Classes</th> |
|---|
| 438 |
<th>Statements</th> |
|---|
| 439 |
<th>Methods</th> |
|---|
| 440 |
<th width="350" colspan="2" nowrap="nowrap">Total coverage</th> |
|---|
| 441 |
</tr> |
|---|
| 442 |
<xsl:apply-templates select="class" mode="stats"> |
|---|
| 443 |
<xsl:sort data-type="number" select="@totalcovered div @totalcount"/> |
|---|
| 444 |
</xsl:apply-templates> |
|---|
| 445 |
</xsl:if> |
|---|
| 446 |
</table> |
|---|
| 447 |
<xsl:call-template name="pageFooter"/> |
|---|
| 448 |
</BODY> |
|---|
| 449 |
</HTML> |
|---|
| 450 |
</xsl:template> |
|---|
| 451 |
|
|---|
| 452 |
<!-- details of a class --> |
|---|
| 453 |
<xsl:template match="class" mode="class.details"> |
|---|
| 454 |
<xsl:variable name="package.name" select="(ancestor::package)[last()]/@name"/> |
|---|
| 455 |
<HTML> |
|---|
| 456 |
<HEAD> |
|---|
| 457 |
<xsl:call-template name="create.stylesheet.link"> |
|---|
| 458 |
<xsl:with-param name="package.name" select="$package.name"/> |
|---|
| 459 |
</xsl:call-template> |
|---|
| 460 |
</HEAD> |
|---|
| 461 |
<BODY> |
|---|
| 462 |
<xsl:call-template name="pageHeader"/> |
|---|
| 463 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 464 |
<tr class="a"> |
|---|
| 465 |
<td class="small">Methods: <xsl:value-of select="@methodcount"/></td> |
|---|
| 466 |
<td class="small">LOC: <xsl:value-of select="count(sourcefile/sourceline)"/></td> |
|---|
| 467 |
<td class="small">Statements: <xsl:value-of select="@statementcount"/></td> |
|---|
| 468 |
</tr> |
|---|
| 469 |
</table> |
|---|
| 470 |
<br/> |
|---|
| 471 |
|
|---|
| 472 |
<!-- class summary --> |
|---|
| 473 |
<table class="log" cellpadding="5" cellspacing="0" width="100%"> |
|---|
| 474 |
<tr> |
|---|
| 475 |
<th width="100%">Source file</th> |
|---|
| 476 |
<th>Statements</th> |
|---|
| 477 |
<th>Methods</th> |
|---|
| 478 |
<th width="250" colspan="2" nowrap="nowrap">Total coverage</th> |
|---|
| 479 |
</tr> |
|---|
| 480 |
<tr> |
|---|
| 481 |
<xsl:call-template name="alternate-row"/> |
|---|
| 482 |
<td><xsl:value-of select="sourcefile/@name"/></td> |
|---|
| 483 |
<xsl:call-template name="stats.formatted"/> |
|---|
| 484 |
</tr> |
|---|
| 485 |
</table> |
|---|
| 486 |
<table cellspacing="0" cellpadding="0" width="100%"> |
|---|
| 487 |
<xsl:apply-templates select="sourcefile/sourceline"/> |
|---|
| 488 |
</table> |
|---|
| 489 |
<br/> |
|---|
| 490 |
<xsl:call-template name="pageFooter"/> |
|---|
| 491 |
</BODY> |
|---|
| 492 |
</HTML> |
|---|
| 493 |
|
|---|
| 494 |
</xsl:template> |
|---|
| 495 |
|
|---|
| 496 |
<!-- Page Header --> |
|---|
| 497 |
<xsl:template name="pageHeader"> |
|---|
| 498 |
<!-- jakarta logo --> |
|---|
| 499 |
<table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|---|
| 500 |
<tr> |
|---|
| 501 |
<td class="bannercell" rowspan="2"> |
|---|
| 502 |
<a href="http://phing.info/"> |
|---|
| 503 |
<img src="http://phing.info/images/phing.gif" alt="http://phing.info/" align="left" border="0"/> |
|---|
| 504 |
</a> |
|---|
| 505 |
</td> |
|---|
| 506 |
<td style="text-align:right"><h2>Source Code Coverage</h2></td> |
|---|
| 507 |
</tr> |
|---|
| 508 |
<tr> |
|---|
| 509 |
<td style="text-align:right">Designed for use with <a href='http://pear.php.net/package/PHPUnit2'>PHPUnit2</a>, <a href='http://www.xdebug.org/'>Xdebug</a> and <a href='http://phing.info/'>Phing</a>.</td> |
|---|
| 510 |
</tr> |
|---|
| 511 |
</table> |
|---|
| 512 |
<hr size="1"/> |
|---|
| 513 |
</xsl:template> |
|---|
| 514 |
|
|---|
| 515 |
<!-- Page Footer --> |
|---|
| 516 |
<xsl:template name="pageFooter"> |
|---|
| 517 |
<table width="100%"> |
|---|
| 518 |
<tr><td><hr noshade="yes" size="1"/></td></tr> |
|---|
| 519 |
<tr><td class="small">Report generated at <xsl:value-of select="date:date-time()"/></td></tr> |
|---|
| 520 |
</table> |
|---|
| 521 |
</xsl:template> |
|---|
| 522 |
|
|---|
| 523 |
<xsl:template match="package" mode="stats"> |
|---|
| 524 |
<tr> |
|---|
| 525 |
<xsl:call-template name="alternate-row"/> |
|---|
| 526 |
<td><xsl:value-of select="@name"/></td> |
|---|
| 527 |
<xsl:call-template name="stats.formatted"/> |
|---|
| 528 |
</tr> |
|---|
| 529 |
</xsl:template> |
|---|
| 530 |
|
|---|
| 531 |
<xsl:template match="class" mode="stats"> |
|---|
| 532 |
<tr> |
|---|
| 533 |
<xsl:call-template name="alternate-row"/> |
|---|
| 534 |
<td><a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a></td> |
|---|
| 535 |
<xsl:call-template name="stats.formatted"/> |
|---|
| 536 |
</tr> |
|---|
| 537 |
</xsl:template> |
|---|
| 538 |
|
|---|
| 539 |
<xsl:template name="stats.formatted"> |
|---|
| 540 |
<xsl:choose> |
|---|
| 541 |
<xsl:when test="@statementcount=0"> |
|---|
| 542 |
<td>-</td> |
|---|
| 543 |
</xsl:when> |
|---|
| 544 |
<xsl:otherwise> |
|---|
| 545 |
<td> |
|---|
| 546 |
<xsl:value-of select="format-number(@statementscovered div @statementcount,'0.0%')"/> |
|---|
| 547 |
</td> |
|---|
| 548 |
</xsl:otherwise> |
|---|
| 549 |
</xsl:choose> |
|---|
| 550 |
<xsl:choose> |
|---|
| 551 |
<xsl:when test="@methodcount=0"> |
|---|
| 552 |
<td>-</td> |
|---|
| 553 |
</xsl:when> |
|---|
| 554 |
<xsl:otherwise> |
|---|
| 555 |
<td> |
|---|
| 556 |
<xsl:value-of select="format-number(@methodscovered div @methodcount,'0.0%')"/> |
|---|
| 557 |
</td> |
|---|
| 558 |
</xsl:otherwise> |
|---|
| 559 |
</xsl:choose> |
|---|
| 560 |
<xsl:choose> |
|---|
| 561 |
<xsl:when test="@totalcount=0"> |
|---|
| 562 |
<td>-</td> |
|---|
| 563 |
<td> |
|---|
| 564 |
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="display: inline"> |
|---|
| 565 |
<tr> |
|---|
| 566 |
<td class="empty" width="200" height="12"> </td> |
|---|
| 567 |
</tr> |
|---|
| 568 |
</table> |
|---|
| 569 |
</td> |
|---|
| 570 |
</xsl:when> |
|---|
| 571 |
<xsl:otherwise> |
|---|
| 572 |
<td> |
|---|
| 573 |
<xsl:value-of select="format-number(@totalcovered div @totalcount,'0.0%')"/> |
|---|
| 574 |
</td> |
|---|
| 575 |
<td> |
|---|
| 576 |
<xsl:variable name="leftwidth"><xsl:value-of select="format-number((@totalcovered * 200) div @totalcount,'0')"/></xsl:variable> |
|---|
| 577 |
<xsl:variable name="rightwidth"><xsl:value-of select="format-number(200 - (@totalcovered * 200) div @totalcount,'0')"/></xsl:variable> |
|---|
| 578 |
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="display: inline"> |
|---|
| 579 |
<tr> |
|---|
| 580 |
<xsl:choose> |
|---|
| 581 |
<xsl:when test="$leftwidth=200"> |
|---|
| 582 |
<td class="fullcover" width="200" height="12"> </td> |
|---|
| 583 |
</xsl:when> |
|---|
| 584 |
<xsl:otherwise> |
|---|
| 585 |
<xsl:if test="not($leftwidth=0)"> |
|---|
| 586 |
<td class="covered" width="{$leftwidth}" height="12"> </td> |
|---|
| 587 |
</xsl:if> |
|---|
| 588 |
<xsl:if test="not($rightwidth=0)"> |
|---|
| 589 |
<td class="uncovered" width="{$rightwidth}" height="12"> </td> |
|---|
| 590 |
</xsl:if> |
|---|
| 591 |
</xsl:otherwise> |
|---|
| 592 |
</xsl:choose> |
|---|
| 593 |
</tr> |
|---|
| 594 |
</table> |
|---|
| 595 |
</td> |
|---|
| 596 |
</xsl:otherwise> |
|---|
| 597 |
</xsl:choose> |
|---|
| 598 |
</xsl:template> |
|---|
| 599 |
|
|---|
| 600 |
<xsl:template match="sourceline"> |
|---|
| 601 |
<tr> |
|---|
| 602 |
<xsl:if test="@coveredcount>0"> |
|---|
| 603 |
<td class="lineCountHighlight"><xsl:value-of select="position()"/></td> |
|---|
| 604 |
<td class="lineCountHighlight"><xsl:value-of select="@coveredcount"/></td> |
|---|
| 605 |
</xsl:if> |
|---|
| 606 |
<xsl:if test="@coveredcount<0"> |
|---|
| 607 |
<td class="lineCountHighlight"><xsl:value-of select="position()"/></td> |
|---|
| 608 |
<td class="coverageCountHighlight">0</td> |
|---|
| 609 |
</xsl:if> |
|---|
| 610 |
<xsl:if test="@coveredcount=0"> |
|---|
| 611 |
<td class="lineCount"><xsl:value-of select="position()"/></td> |
|---|
| 612 |
<td class="coverageCount"></td> |
|---|
| 613 |
</xsl:if> |
|---|
| 614 |
<td> |
|---|
| 615 |
<xsl:if test="@startclass=1"> |
|---|
| 616 |
<xsl:attribute name="class">srcLineClassStart</xsl:attribute> |
|---|
| 617 |
</xsl:if> |
|---|
| 618 |
<xsl:if test="@coveredcount>0"> |
|---|
| 619 |
<span class="srcLine"> |
|---|
| 620 |
<pre class="srcLine"><xsl:value-of select="."/></pre> |
|---|
| 621 |
</span> |
|---|
| 622 |
</xsl:if> |
|---|
| 623 |
<xsl:if test="@coveredcount<0"> |
|---|
| 624 |
<span class="srcLineHighlight"> |
|---|
| 625 |
<pre class="srcLine"><xsl:value-of select="."/></pre> |
|---|
| 626 |
</span> |
|---|
| 627 |
</xsl:if> |
|---|
| 628 |
<xsl:if test="@coveredcount=0"> |
|---|
| 629 |
<pre class="srcLine"><xsl:value-of select="."/></pre> |
|---|
| 630 |
</xsl:if> |
|---|
| 631 |
</td> |
|---|
| 632 |
</tr> |
|---|
| 633 |
</xsl:template> |
|---|
| 634 |
|
|---|
| 635 |
<!-- |
|---|
| 636 |
transform string like a.b.c to ../../../ |
|---|
| 637 |
@param path the path to transform into a descending directory path |
|---|
| 638 |
--> |
|---|
| 639 |
<xsl:template name="path"> |
|---|
| 640 |
<xsl:param name="path"/> |
|---|
| 641 |
<xsl:if test="contains($path,'.')"> |
|---|
| 642 |
<xsl:text>../</xsl:text> |
|---|
| 643 |
<xsl:call-template name="path"> |
|---|
| 644 |
<xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param> |
|---|
| 645 |
</xsl:call-template> |
|---|
| 646 |
</xsl:if> |
|---|
| 647 |
<xsl:if test="not(contains($path,'.')) and not($path = '')"> |
|---|
| 648 |
<xsl:text>../</xsl:text> |
|---|
| 649 |
</xsl:if> |
|---|
| 650 |
</xsl:template> |
|---|
| 651 |
|
|---|
| 652 |
|
|---|
| 653 |
<!-- create the link to the stylesheet based on the package name --> |
|---|
| 654 |
<xsl:template name="create.stylesheet.link"> |
|---|
| 655 |
<xsl:param name="package.name"/> |
|---|
| 656 |
<LINK REL ="stylesheet" TYPE="text/css" TITLE="Style"><xsl:attribute name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template name="path"><xsl:with-param name="path" select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></LINK> |
|---|
| 657 |
</xsl:template> |
|---|
| 658 |
|
|---|
| 659 |
<!-- alternated row style --> |
|---|
| 660 |
<xsl:template name="alternate-row"> |
|---|
| 661 |
<xsl:attribute name="class"> |
|---|
| 662 |
<xsl:if test="position() mod 2 = 1">a</xsl:if> |
|---|
| 663 |
<xsl:if test="position() mod 2 = 0">b</xsl:if> |
|---|
| 664 |
</xsl:attribute> |
|---|
| 665 |
</xsl:template> |
|---|
| 666 |
|
|---|
| 667 |
</xsl:stylesheet> |
|---|
| 668 |
|
|---|
| 669 |
|
|---|