Commit | Line | Data |
---|---|---|
6a488035 TO |
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 | |
31037a42 | 9 | |
6a488035 TO |
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 | |
31037a42 | 13 | |
6a488035 | 14 | http://www.apache.org/licenses/LICENSE-2.0 |
31037a42 | 15 | |
6a488035 TO |
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. | |
31037a42 | 21 | |
6a488035 TO |
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 { | |
31037a42 | 175 | BACKGROUND: #ffffff; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; |
6a488035 TO |
176 | } |
177 | PRE.srcLineHighLight { | |
31037a42 | 178 | BACKGROUND: #F0C8C8; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; |
6a488035 TO |
179 | } |
180 | td.lineCount, td.coverageCount { | |
181 | BACKGROUND: #F0F0F0; PADDING-RIGHT: 3px; | |
182 | text-align: right; | |
183 | } | |
184 | td.lineCountHighlight { | |
185 | background: #C8C8F0; PADDING-RIGHT: 3px; | |
186 | text-align: right; | |
187 | } | |
188 | td.coverageCountHighlight { | |
189 | background: #F0C8C8; PADDING-RIGHT: 3px; | |
190 | text-align: right; | |
191 | } | |
192 | td.srcLineHighlight { | |
193 | background: #F0C8C8; | |
194 | } | |
195 | td.srcLine { | |
196 | background: #C8C8F0; | |
197 | } | |
198 | TD.srcLineClassStart { | |
31037a42 | 199 | WIDTH: 100%; BORDER-TOP:#dcdcdc 1px solid; FONT-WEIGHT: bold; |
6a488035 TO |
200 | } |
201 | .srcLine , .srcLine ol, .srcLine ol li {margin: 0;} | |
202 | .srcLine .de1, .srcLine .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} | |
203 | .srcLine .imp {font-weight: bold; color: red;} | |
204 | .srcLine .kw1 {color: #b1b100;} | |
205 | .srcLine .kw2 {color: #000000; font-weight: bold;} | |
206 | .srcLine .kw3 {color: #000066;} | |
207 | .srcLine .co1 {color: #808080; font-style: italic;} | |
208 | .srcLine .co2 {color: #808080; font-style: italic;} | |
209 | .srcLine .coMULTI {color: #808080; font-style: italic;} | |
210 | .srcLine .es0 {color: #000099; font-weight: bold;} | |
211 | .srcLine .br0 {color: #66cc66;} | |
212 | .srcLine .st0 {color: #ff0000;} | |
213 | .srcLine .nu0 {color: #cc66cc;} | |
214 | .srcLine .me1 {color: #006600;} | |
215 | .srcLine .me2 {color: #006600;} | |
216 | .srcLine .re0 {color: #0000ff;} | |
217 | </xsl:template> | |
218 | ||
219 | <!-- ======================================================================= | |
220 | List of all classes in all packages | |
221 | This will be the first page in the classListFrame | |
222 | ======================================================================= --> | |
223 | <xsl:template match="snapshot" mode="all.classes"> | |
224 | <html> | |
225 | <head> | |
226 | <xsl:call-template name="create.stylesheet.link"/> | |
227 | </head> | |
228 | <body> | |
229 | <h2>All Classes</h2> | |
230 | <table width="100%"> | |
231 | <xsl:for-each select="package/class"> | |
232 | <xsl:sort select="@name"/> | |
233 | <xsl:variable name="package.name" select="(ancestor::package)[last()]/@name"/> | |
234 | <xsl:variable name="link"> | |
235 | <xsl:if test="not($package.name='')"> | |
236 | <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text> | |
237 | </xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text> | |
238 | </xsl:variable> | |
239 | <tr> | |
240 | <td nowrap="nowrap"> | |
241 | <a target="classFrame" href="{$link}"><xsl:value-of select="@name"/></a> | |
242 | <xsl:choose> | |
243 | <xsl:when test="@totalcount=0"> | |
244 | <i> (-)</i> | |
245 | </xsl:when> | |
246 | <xsl:otherwise> | |
247 | <i> (<xsl:value-of select="format-number(@totalcovered div @totalcount, '0.0%')"/>)</i> | |
248 | </xsl:otherwise> | |
249 | </xsl:choose> | |
250 | </td> | |
251 | </tr> | |
252 | </xsl:for-each> | |
253 | </table> | |
254 | </body> | |
255 | </html> | |
256 | </xsl:template> | |
257 | ||
258 | <!-- list of all packages --> | |
259 | <xsl:template match="snapshot" mode="all.packages"> | |
260 | <html> | |
261 | <head> | |
262 | <xsl:call-template name="create.stylesheet.link"/> | |
263 | </head> | |
264 | <body> | |
265 | <h2><a href="overview-summary.html" target="classFrame">Overview</a></h2> | |
266 | <h2>All Packages</h2> | |
267 | <table width="100%"> | |
268 | <xsl:for-each select="package"> | |
269 | <xsl:sort select="@name" order="ascending"/> | |
270 | <tr> | |
271 | <td nowrap="nowrap"> | |
272 | <a href="{translate(@name,'.','/')}/package-summary.html" target="classFrame"> | |
273 | <xsl:value-of select="@name"/> | |
274 | </a> | |
275 | </td> | |
276 | </tr> | |
277 | </xsl:for-each> | |
278 | </table> | |
279 | </body> | |
280 | </html> | |
281 | </xsl:template> | |
282 | ||
283 | <!-- overview of statistics in packages --> | |
284 | <xsl:template match="snapshot" mode="overview.packages"> | |
285 | <html> | |
286 | <head> | |
287 | <xsl:call-template name="create.stylesheet.link"/> | |
288 | </head> | |
289 | <body onload="open('allclasses-frame.html','classListFrame')"> | |
290 | <xsl:call-template name="pageHeader"/> | |
291 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
292 | <tr class="a"> | |
293 | <td class="small">Packages: <xsl:value-of select="count(package)"/></td> | |
294 | <td class="small">Classes: <xsl:value-of select="count(package/class)"/></td> | |
295 | <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> | |
296 | <td class="small">LOC: <xsl:value-of select="count(package/class/sourcefile/sourceline)"/></td> | |
297 | <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> | |
298 | </tr> | |
31037a42 | 299 | </table> |
6a488035 TO |
300 | <br/> |
301 | ||
302 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
303 | <tr> | |
304 | <th width="100%" nowrap="nowrap"></th> | |
305 | <th>Statements</th> | |
306 | <th>Methods</th> | |
307 | <th width="350" colspan="2" nowrap="nowrap">Total coverage</th> | |
308 | </tr> | |
309 | <tr class="a"> | |
310 | <td><b>Project</b></td> | |
311 | <xsl:call-template name="stats.formatted"/> | |
312 | </tr> | |
313 | <tr> | |
314 | <td colspan="3"><br/></td> | |
315 | </tr> | |
316 | <tr> | |
317 | <th width="100%">Packages</th> | |
318 | <th>Statements</th> | |
319 | <th>Methods</th> | |
320 | <th width="350" colspan="2" nowrap="nowrap">Total coverage</th> | |
321 | </tr> | |
322 | <!-- display packages and sort them via their coverage rate --> | |
323 | <xsl:for-each select="package"> | |
324 | <xsl:sort data-type="number" select="@totalcovered div @totalcount"/> | |
325 | <tr> | |
326 | <xsl:call-template name="alternate-row"/> | |
327 | <td><a href="{translate(@name,'.','/')}/package-summary.html"><xsl:value-of select="@name"/></a></td> | |
328 | <xsl:call-template name="stats.formatted"/> | |
329 | </tr> | |
330 | </xsl:for-each> | |
331 | </table> | |
332 | <xsl:call-template name="pageFooter"/> | |
333 | </body> | |
334 | </html> | |
335 | </xsl:template> | |
336 | ||
337 | <!-- | |
338 | detailed info for a package. It will output the list of classes | |
339 | , the summary page, and the info for each class | |
340 | --> | |
341 | <xsl:template match="package" mode="write"> | |
342 | <xsl:variable name="package.dir"> | |
343 | <xsl:if test="not(@name = '')"><xsl:value-of select="translate(@name,'.','/')"/></xsl:if> | |
344 | <xsl:if test="@name = ''">.</xsl:if> | |
345 | </xsl:variable> | |
346 | ||
347 | <!-- create a classes-list.html in the package directory --> | |
348 | <exsl:document href="efile://{$output.dir}/{$package.dir}/package-frame.html"> | |
349 | <xsl:apply-templates select="." mode="classes.list"/> | |
350 | </exsl:document> | |
351 | ||
352 | <!-- create a package-summary.html in the package directory --> | |
353 | <exsl:document href="efile://{$output.dir}/{$package.dir}/package-summary.html"> | |
354 | <xsl:apply-templates select="." mode="package.summary"/> | |
355 | </exsl:document> | |
356 | ||
357 | <!-- for each class, creates a @name.html --> | |
358 | <xsl:for-each select="class"> | |
359 | <exsl:document href="efile://{$output.dir}/{$package.dir}/{@name}.html"> | |
360 | <xsl:apply-templates select="." mode="class.details"/> | |
361 | </exsl:document> | |
362 | </xsl:for-each> | |
363 | </xsl:template> | |
364 | ||
365 | <!-- list of classes in a package --> | |
366 | <xsl:template match="package" mode="classes.list"> | |
367 | <html> | |
368 | <HEAD> | |
369 | <xsl:call-template name="create.stylesheet.link"> | |
370 | <xsl:with-param name="package.name" select="@name"/> | |
371 | </xsl:call-template> | |
372 | </HEAD> | |
373 | <BODY> | |
374 | <table width="100%"> | |
375 | <tr> | |
376 | <td nowrap="nowrap"> | |
377 | <H2><a href="package-summary.html" target="classFrame"><xsl:value-of select="@name"/></a></H2> | |
378 | </td> | |
379 | </tr> | |
380 | </table> | |
381 | ||
382 | <H2>Classes</H2> | |
383 | <TABLE WIDTH="100%"> | |
384 | <xsl:for-each select="class"> | |
385 | <xsl:sort select="@name"/> | |
386 | <tr> | |
387 | <td nowrap="nowrap"> | |
388 | <a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a> | |
389 | <xsl:choose> | |
390 | <xsl:when test="@totalcount=0"> | |
391 | <i> (-)</i> | |
392 | </xsl:when> | |
393 | <xsl:otherwise> | |
394 | <i>(<xsl:value-of select="format-number(@totalcovered div @totalcount, '0.0%')"/>)</i> | |
395 | </xsl:otherwise> | |
396 | </xsl:choose> | |
397 | </td> | |
398 | </tr> | |
399 | </xsl:for-each> | |
400 | </TABLE> | |
401 | </BODY> | |
402 | </html> | |
403 | </xsl:template> | |
404 | ||
405 | <!-- summary of a package --> | |
406 | <xsl:template match="package" mode="package.summary"> | |
407 | <HTML> | |
408 | <HEAD> | |
409 | <xsl:call-template name="create.stylesheet.link"> | |
410 | <xsl:with-param name="package.name" select="@name"/> | |
411 | </xsl:call-template> | |
412 | </HEAD> | |
413 | <!-- when loading this package, it will open the classes into the frame --> | |
414 | <BODY onload="open('package-frame.html','classListFrame')"> | |
415 | <xsl:call-template name="pageHeader"/> | |
416 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
417 | <tr class="a"> | |
418 | <td class="small">Classes: <xsl:value-of select="count(class)"/></td> | |
419 | <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> | |
420 | <td class="small">LOC: <xsl:value-of select="count(class/sourcefile/sourceline)"/></td> | |
421 | <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> | |
422 | </tr> | |
31037a42 | 423 | </table> |
6a488035 TO |
424 | <br/> |
425 | ||
426 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
427 | <tr> | |
428 | <th width="100%">Package</th> | |
429 | <th>Statements</th> | |
430 | <th>Methods</th> | |
431 | <th width="350" colspan="2" nowrap="nowrap">Total coverage</th> | |
432 | </tr> | |
433 | <xsl:apply-templates select="." mode="stats"/> | |
434 | ||
435 | <xsl:if test="count(class) > 0"> | |
436 | <tr> | |
437 | <td colspan="3"><br/></td> | |
438 | </tr> | |
439 | <tr> | |
440 | <th width="100%">Classes</th> | |
441 | <th>Statements</th> | |
442 | <th>Methods</th> | |
443 | <th width="350" colspan="2" nowrap="nowrap">Total coverage</th> | |
444 | </tr> | |
445 | <xsl:apply-templates select="class" mode="stats"> | |
446 | <xsl:sort data-type="number" select="@totalcovered div @totalcount"/> | |
447 | </xsl:apply-templates> | |
448 | </xsl:if> | |
449 | </table> | |
450 | <xsl:call-template name="pageFooter"/> | |
451 | </BODY> | |
452 | </HTML> | |
453 | </xsl:template> | |
454 | ||
455 | <!-- details of a class --> | |
456 | <xsl:template match="class" mode="class.details"> | |
457 | <xsl:variable name="package.name" select="(ancestor::package)[last()]/@name"/> | |
458 | <HTML> | |
459 | <HEAD> | |
460 | <xsl:call-template name="create.stylesheet.link"> | |
461 | <xsl:with-param name="package.name" select="$package.name"/> | |
462 | </xsl:call-template> | |
463 | </HEAD> | |
464 | <BODY> | |
465 | <xsl:call-template name="pageHeader"/> | |
466 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
467 | <tr class="a"> | |
468 | <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> | |
469 | <td class="small">LOC: <xsl:value-of select="count(sourcefile/sourceline)"/></td> | |
470 | <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> | |
471 | </tr> | |
31037a42 | 472 | </table> |
6a488035 TO |
473 | <br/> |
474 | ||
475 | <!-- class summary --> | |
476 | <table class="log" cellpadding="5" cellspacing="0" width="100%"> | |
477 | <tr> | |
478 | <th width="100%">Source file</th> | |
479 | <th>Statements</th> | |
480 | <th>Methods</th> | |
481 | <th width="250" colspan="2" nowrap="nowrap">Total coverage</th> | |
482 | </tr> | |
483 | <tr> | |
484 | <xsl:call-template name="alternate-row"/> | |
485 | <td><xsl:value-of select="sourcefile/@name"/></td> | |
486 | <xsl:call-template name="stats.formatted"/> | |
487 | </tr> | |
488 | </table> | |
489 | <table cellspacing="0" cellpadding="0" width="100%"> | |
490 | <xsl:apply-templates select="sourcefile/sourceline"/> | |
491 | </table> | |
492 | <br/> | |
493 | <xsl:call-template name="pageFooter"/> | |
494 | </BODY> | |
495 | </HTML> | |
496 | ||
497 | </xsl:template> | |
498 | ||
499 | <!-- Page Header --> | |
500 | <xsl:template name="pageHeader"> | |
501 | <!-- jakarta logo --> | |
502 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> | |
503 | <tr> | |
504 | <td class="bannercell" rowspan="2"> | |
505 | <a href="http://phing.info/"> | |
506 | <img src="http://phing.info/images/phing.gif" alt="http://phing.info/" align="left" border="0"/> | |
507 | </a> | |
508 | </td> | |
509 | <td style="text-align:right"><h2>Source Code Coverage</h2></td> | |
510 | </tr> | |
511 | <tr> | |
512 | <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> | |
513 | </tr> | |
514 | </table> | |
515 | <hr size="1"/> | |
516 | </xsl:template> | |
517 | ||
518 | <!-- Page Footer --> | |
519 | <xsl:template name="pageFooter"> | |
520 | <table width="100%"> | |
521 | <tr><td><hr noshade="yes" size="1"/></td></tr> | |
522 | <tr><td class="small">Report generated at <xsl:value-of select="date:date-time()"/></td></tr> | |
523 | </table> | |
524 | </xsl:template> | |
525 | ||
526 | <xsl:template match="package" mode="stats"> | |
527 | <tr> | |
528 | <xsl:call-template name="alternate-row"/> | |
529 | <td><xsl:value-of select="@name"/></td> | |
530 | <xsl:call-template name="stats.formatted"/> | |
531 | </tr> | |
532 | </xsl:template> | |
533 | ||
534 | <xsl:template match="class" mode="stats"> | |
535 | <tr> | |
536 | <xsl:call-template name="alternate-row"/> | |
537 | <td><a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a></td> | |
538 | <xsl:call-template name="stats.formatted"/> | |
539 | </tr> | |
540 | </xsl:template> | |
541 | ||
542 | <xsl:template name="stats.formatted"> | |
543 | <xsl:choose> | |
544 | <xsl:when test="@statementcount=0"> | |
545 | <td>-</td> | |
546 | </xsl:when> | |
547 | <xsl:otherwise> | |
548 | <td> | |
549 | <xsl:value-of select="format-number(@statementscovered div @statementcount,'0.0%')"/> | |
550 | </td> | |
551 | </xsl:otherwise> | |
552 | </xsl:choose> | |
553 | <xsl:choose> | |
554 | <xsl:when test="@methodcount=0"> | |
555 | <td>-</td> | |
556 | </xsl:when> | |
557 | <xsl:otherwise> | |
558 | <td> | |
559 | <xsl:value-of select="format-number(@methodscovered div @methodcount,'0.0%')"/> | |
560 | </td> | |
561 | </xsl:otherwise> | |
562 | </xsl:choose> | |
563 | <xsl:choose> | |
564 | <xsl:when test="@totalcount=0"> | |
565 | <td>-</td> | |
566 | <td> | |
567 | <table cellspacing="0" cellpadding="0" border="0" width="100%" style="display: inline"> | |
568 | <tr> | |
569 | <td class="empty" width="200" height="12"> </td> | |
570 | </tr> | |
571 | </table> | |
572 | </td> | |
573 | </xsl:when> | |
574 | <xsl:otherwise> | |
575 | <td> | |
576 | <xsl:value-of select="format-number(@totalcovered div @totalcount,'0.0%')"/> | |
577 | </td> | |
578 | <td> | |
579 | <xsl:variable name="leftwidth"><xsl:value-of select="format-number((@totalcovered * 200) div @totalcount,'0')"/></xsl:variable> | |
580 | <xsl:variable name="rightwidth"><xsl:value-of select="format-number(200 - (@totalcovered * 200) div @totalcount,'0')"/></xsl:variable> | |
581 | <table cellspacing="0" cellpadding="0" border="0" width="100%" style="display: inline"> | |
582 | <tr> | |
583 | <xsl:choose> | |
584 | <xsl:when test="$leftwidth=200"> | |
585 | <td class="fullcover" width="200" height="12"> </td> | |
586 | </xsl:when> | |
587 | <xsl:otherwise> | |
588 | <xsl:if test="not($leftwidth=0)"> | |
589 | <td class="covered" width="{$leftwidth}" height="12"> </td> | |
590 | </xsl:if> | |
591 | <xsl:if test="not($rightwidth=0)"> | |
592 | <td class="uncovered" width="{$rightwidth}" height="12"> </td> | |
593 | </xsl:if> | |
594 | </xsl:otherwise> | |
595 | </xsl:choose> | |
596 | </tr> | |
597 | </table> | |
598 | </td> | |
599 | </xsl:otherwise> | |
600 | </xsl:choose> | |
601 | </xsl:template> | |
602 | ||
603 | <xsl:template match="sourceline"> | |
604 | <tr> | |
605 | <xsl:if test="@coveredcount>0"> | |
606 | <td class="lineCountHighlight"><xsl:value-of select="position()"/></td> | |
607 | <td class="lineCountHighlight"><xsl:value-of select="@coveredcount"/></td> | |
608 | </xsl:if> | |
609 | <xsl:if test="@coveredcount<0"> | |
610 | <td class="lineCountHighlight"><xsl:value-of select="position()"/></td> | |
611 | <td class="coverageCountHighlight">0</td> | |
612 | </xsl:if> | |
613 | <xsl:if test="@coveredcount=0"> | |
614 | <td class="lineCount"><xsl:value-of select="position()"/></td> | |
615 | <td class="coverageCount"></td> | |
616 | </xsl:if> | |
617 | <td> | |
618 | <xsl:if test="@startclass=1"> | |
619 | <xsl:attribute name="class">srcLineClassStart</xsl:attribute> | |
620 | </xsl:if> | |
621 | <xsl:if test="@coveredcount>0"> | |
622 | <pre class="srcLine"><xsl:value-of select="."/></pre> | |
623 | </xsl:if> | |
624 | <xsl:if test="@coveredcount<0"> | |
625 | <pre class="srcLineHighlight"><xsl:value-of select="."/></pre> | |
626 | </xsl:if> | |
627 | <xsl:if test="@coveredcount=0"> | |
628 | <pre class="srcLine"><xsl:value-of select="."/></pre> | |
629 | </xsl:if> | |
630 | </td> | |
631 | </tr> | |
632 | </xsl:template> | |
633 | ||
634 | <!-- | |
635 | transform string like a.b.c to ../../../ | |
636 | @param path the path to transform into a descending directory path | |
637 | --> | |
638 | <xsl:template name="path"> | |
639 | <xsl:param name="path"/> | |
640 | <xsl:if test="contains($path,'.')"> | |
641 | <xsl:text>../</xsl:text> | |
642 | <xsl:call-template name="path"> | |
643 | <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param> | |
644 | </xsl:call-template> | |
645 | </xsl:if> | |
646 | <xsl:if test="not(contains($path,'.')) and not($path = '')"> | |
647 | <xsl:text>../</xsl:text> | |
648 | </xsl:if> | |
649 | </xsl:template> | |
650 | ||
651 | ||
652 | <!-- create the link to the stylesheet based on the package name --> | |
653 | <xsl:template name="create.stylesheet.link"> | |
654 | <xsl:param name="package.name"/> | |
655 | <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> | |
656 | </xsl:template> | |
657 | ||
658 | <!-- alternated row style --> | |
659 | <xsl:template name="alternate-row"> | |
660 | <xsl:attribute name="class"> | |
661 | <xsl:if test="position() mod 2 = 1">a</xsl:if> | |
662 | <xsl:if test="position() mod 2 = 0">b</xsl:if> | |
663 | </xsl:attribute> | |
664 | </xsl:template> | |
665 | ||
666 | </xsl:stylesheet> | |
667 | ||
668 |