main
1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
2 <!-- Created for NCoverExplorer by Grant Drake (see http://www.kiwidude.com/blog/) -->
3 <xsl:output method="html" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
4
5 <xsl:template match="/">
6 <html>
7 <head>
8 <xsl:comment>Generated by NCoverExplorer (see http://www.kiwidude.com/blog/)</xsl:comment>
9 <title>NCoverExplorer - Merged Report</title>
10 <style>
11 body { font: small verdana, arial, helvetica; color:#000000; }
12 .coverageReportTable { font-size: 9px; }
13 .reportHeader { padding: 5px 8px 5px 8px; font-size: 12px; border: 1px solid; margin: 0px; }
14 .titleText { font-weight: bold; font-size: 12px; white-space: nowrap; padding: 0px; margin: 1px; }
15 .subtitleText { font-size: 9px; font-weight: normal; padding: 0px; margin: 1px; white-space: nowrap; }
16 .projectStatistics { font-size: 10px; border-left: #649cc0 1px solid; white-space: nowrap; width: 40%; }
17 .heading { font-weight: bold; }
18 .mainTableHeaderLeft { border: #dcdcdc 1px solid; font-weight: bold; padding-left: 5px; }
19 .mainTableHeader { border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; text-align: center; }
20 .mainTableGraphHeader { border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; text-align: left; font-weight: bold; }
21 .mainTableCellItem { background: #ffffff; border-left: #dcdcdc 1px solid; border-right: #dcdcdc 1px solid; padding-left: 10px; padding-right: 10px; font-weight: bold; font-size: 10px; }
22 .mainTableCellData { background: #ffffff; border-right: #dcdcdc 1px solid; text-align: center; white-space: nowrap; }
23 .mainTableCellPercent { background: #ffffff; font-weight: bold; white-space: nowrap; text-align: right; padding-left: 10px; }
24 .mainTableCellGraph { background: #ffffff; border-right: #dcdcdc 1px solid; padding-right: 5px; }
25 .mainTableCellBottom { border-bottom: #dcdcdc 1px solid; }
26 .childTableHeader { border-top: 1px solid; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; font-weight: bold; padding-left: 10px; }
27 .childTableCellIndentedItem { background: #ffffff; border-left: #dcdcdc 1px solid; border-right: #dcdcdc 1px solid; padding-right: 10px; font-size: 10px; }
28 .exclusionTableCellItem { background: #ffffff; border-left: #dcdcdc 1px solid; border-right: #dcdcdc 1px solid; padding-left: 10px; padding-right: 10px; }
29 .projectTable { background: #a9d9f7; border-color: #649cc0; }
30 .primaryTable { background: #d7eefd; border-color: #a4dafc; }
31 .secondaryTable { background: #f9e9b7; border-color: #f6d376; }
32 .secondaryChildTable { background: #fff6df; border-color: #f5e1b1; }
33 .exclusionTable { background: #fadada; border-color: #f37f7f; }
34 .graphBarNotVisited { font-size: 2px; border:#9c9c9c 1px solid; background:#df0000; }
35 .graphBarSatisfactory { font-size: 2px; border:#9c9c9c 1px solid; background:#f4f24e; }
36 .graphBarVisited { background: #00df00; font-size: 2px; border-left:#9c9c9c 1px solid; border-top:#9c9c9c 1px solid; border-bottom:#9c9c9c 1px solid; }
37 .graphBarVisitedFully { background: #00df00; font-size: 2px; border:#9c9c9c 1px solid; }
38 </style>
39 </head>
40 <body>
41 <table class="coverageReportTable" cellpadding="2" cellspacing="0">
42 <tbody>
43 <xsl:apply-templates select="//coverageReport" />
44 </tbody>
45 </table>
46 </body>
47 </html>
48 </xsl:template>
49
50 <!-- Main Project Section -->
51 <xsl:template match="//coverageReport">
52 <xsl:variable name="reportType" select="./@reportTitle" />
53 <xsl:variable name="threshold">
54 <xsl:choose>
55 <xsl:when test="$reportType = 'Module Class Function Summary'"><xsl:value-of select="./project/@acceptableFunction" /></xsl:when>
56 <xsl:otherwise><xsl:value-of select="./project/@acceptable" /></xsl:otherwise>
57 </xsl:choose>
58 </xsl:variable>
59 <xsl:variable name="unvisitedTitle">
60 <xsl:choose>
61 <xsl:when test="$reportType = 'Module Class Function Summary'">Unvisited Functions</xsl:when>
62 <xsl:otherwise>Unvisited SeqPts</xsl:otherwise>
63 </xsl:choose>
64 </xsl:variable>
65 <xsl:variable name="coverageTitle">
66 <xsl:choose>
67 <xsl:when test="$reportType = 'Module Class Function Summary'">Function Coverage</xsl:when>
68 <xsl:otherwise>Coverage</xsl:otherwise>
69 </xsl:choose>
70 </xsl:variable>
71
72 <xsl:call-template name="header" />
73
74 <xsl:call-template name="projectSummary">
75 <xsl:with-param name="threshold" select="$threshold" />
76 <xsl:with-param name="unvisitedTitle" select="$unvisitedTitle" />
77 <xsl:with-param name="coverageTitle" select="$coverageTitle" />
78 <xsl:with-param name="reportType" select="$reportType" />
79 </xsl:call-template>
80
81 <xsl:call-template name="moduleSummary">
82 <xsl:with-param name="threshold" select="$threshold" />
83 <xsl:with-param name="unvisitedTitle" select="$unvisitedTitle" />
84 <xsl:with-param name="coverageTitle" select="$coverageTitle" />
85 </xsl:call-template>
86
87 <xsl:if test="$reportType = 'Module Namespace Summary'">
88 <xsl:call-template name="moduleNamespaceSummary">
89 <xsl:with-param name="threshold" select="$threshold" />
90 </xsl:call-template>
91 </xsl:if>
92
93 <xsl:if test="($reportType = 'Module Class Summary') or ($reportType = 'Module Class Function Summary')">
94 <xsl:call-template name="classModuleSummary">
95 <xsl:with-param name="threshold" select="$threshold" />
96 <xsl:with-param name="unvisitedTitle" select="$unvisitedTitle" />
97 <xsl:with-param name="coverageTitle" select="$coverageTitle" />
98 </xsl:call-template>
99 </xsl:if>
100
101 <xsl:if test="count(./exclusions/exclusion) != 0">
102 <xsl:call-template name="exclusionsSummary" />
103 </xsl:if>
104
105 <xsl:call-template name="footer" />
106 </xsl:template>
107
108
109 <!-- Report Header -->
110 <xsl:template name="header">
111 <tr>
112 <td class="projectTable reportHeader" colspan="5">
113 <table width="100%">
114 <tbody>
115 <tr>
116 <td valign="top">
117 <h1 class="titleText">NCoverExplorer Coverage Report - <xsl:value-of select="./project/@name" />  </h1>
118 <table cellpadding="1" class="subtitleText">
119 <tbody>
120 <tr>
121 <td class="heading">Report generated on:</td>
122 <td><xsl:value-of select="./@date" /> at <xsl:value-of select="./@time" /></td>
123 </tr>
124 <tr>
125 <td class="heading">NCoverExplorer version:</td>
126 <td><xsl:value-of select="./@version" /></td>
127 </tr>
128 <tr>
129 <td class="heading">Filtering / Sorting:</td>
130 <td><xsl:value-of select="./project/@filteredBy" /> / <xsl:value-of select="./project/@sortedBy" /></td>
131 </tr>
132 </tbody>
133 </table>
134 </td>
135 <td class="projectStatistics" align="right" valign="top">
136 <table cellpadding="1">
137 <tbody>
138 <tr>
139 <td rowspan="4" valign="top" nowrap="true" class="heading">Project Statistics:</td>
140 <td align="right" class="heading">Files:</td>
141 <td align="right"><xsl:value-of select="./project/@files" /></td>
142 <td rowspan="4"> </td>
143 <td align="right" class="heading">NCLOC:</td>
144 <td align="right"><xsl:value-of select="./project/@nonCommentLines" /></td>
145 </tr>
146 <tr>
147 <td align="right" class="heading">Classes:</td>
148 <td align="right"><xsl:value-of select="./project/@classes" /></td>
149 <td align="right" class="heading"> </td>
150 <td align="right"> </td>
151 </tr>
152 <tr>
153 <td align="right" class="heading">Functions:</td>
154 <td align="right"><xsl:value-of select="./project/@members" /></td>
155 <td align="right" class="heading">Unvisited:</td>
156 <td align="right"><xsl:value-of select="./project/@unvisitedFunctions" /></td>
157 </tr>
158 <tr>
159 <td align="right" class="heading">Seq Pts:</td>
160 <td align="right"><xsl:value-of select="./project/@sequencePoints" /></td>
161 <td align="right" class="heading">Unvisited:</td>
162 <td align="right"><xsl:value-of select="./project/@unvisitedPoints" /></td>
163 </tr>
164 </tbody>
165 </table>
166 </td>
167 </tr>
168 </tbody>
169 </table>
170 </td>
171 </tr>
172 </xsl:template>
173
174 <!-- Project Summary -->
175 <xsl:template name="projectSummary">
176 <xsl:param name="threshold" />
177 <xsl:param name="unvisitedTitle" />
178 <xsl:param name="coverageTitle" />
179 <xsl:param name="reportType" />
180 <tr>
181 <td colspan="5"> </td>
182 </tr>
183 <tr>
184 <td class="projectTable mainTableHeaderLeft">Project</td>
185 <td class="projectTable mainTableHeader">Acceptable</td>
186 <td class="projectTable mainTableHeader"><xsl:value-of select="$unvisitedTitle" /></td>
187 <td class="projectTable mainTableGraphHeader" colspan="2"><xsl:value-of select="$coverageTitle" /></td>
188 </tr>
189 <xsl:call-template name="coverageDetail">
190 <xsl:with-param name="name" select="./project/@name" />
191 <xsl:with-param name="unvisitedPoints">
192 <xsl:choose>
193 <xsl:when test="$reportType = 'Module Class Function Summary'"><xsl:value-of select="./project/@unvisitedFunctions" /></xsl:when>
194 <xsl:otherwise><xsl:value-of select="./project/@unvisitedPoints" /></xsl:otherwise>
195 </xsl:choose>
196 </xsl:with-param>
197 <xsl:with-param name="sequencePoints">
198 <xsl:choose>
199 <xsl:when test="$reportType = 'Module Class Function Summary'"><xsl:value-of select="./project/@members" /></xsl:when>
200 <xsl:otherwise><xsl:value-of select="./project/@sequencePoints" /></xsl:otherwise>
201 </xsl:choose>
202 </xsl:with-param>
203 <xsl:with-param name="coverage">
204 <xsl:choose>
205 <xsl:when test="$reportType = 'Module Class Function Summary'"><xsl:value-of select="./project/@functionCoverage" /></xsl:when>
206 <xsl:otherwise><xsl:value-of select="./project/@coverage" /></xsl:otherwise>
207 </xsl:choose>
208 </xsl:with-param>
209 <xsl:with-param name="threshold" select="$threshold" />
210 <xsl:with-param name="showThreshold">True</xsl:with-param>
211 </xsl:call-template>
212 </xsl:template>
213
214 <!-- Modules Summary -->
215 <xsl:template name="moduleSummary">
216 <xsl:param name="threshold" />
217 <xsl:param name="unvisitedTitle" />
218 <xsl:param name="coverageTitle" />
219 <tr>
220 <td colspan="5"> </td>
221 </tr>
222 <tr>
223 <td class="primaryTable mainTableHeaderLeft">Modules</td>
224 <td class="primaryTable mainTableHeader">Acceptable</td>
225 <td class="primaryTable mainTableHeader"><xsl:value-of select="$unvisitedTitle" /></td>
226 <td class="primaryTable mainTableGraphHeader" colspan="2"><xsl:value-of select="$coverageTitle" /></td>
227 </tr>
228 <xsl:for-each select="./modules/module">
229 <xsl:call-template name="coverageDetail">
230 <xsl:with-param name="name" select="./@name" />
231 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
232 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
233 <xsl:with-param name="coverage" select="./@coverage" />
234 <xsl:with-param name="threshold" select="./@acceptable" />
235 <xsl:with-param name="showThreshold">True</xsl:with-param>
236 </xsl:call-template>
237 </xsl:for-each>
238 </xsl:template>
239
240 <!-- Namespaces per Module Summary -->
241 <xsl:template name="moduleNamespaceSummary">
242 <xsl:param name="threshold" />
243 <xsl:for-each select="./modules/module">
244 <tr>
245 <td colspan="5"> </td>
246 </tr>
247 <tr>
248 <td class="secondaryTable mainTableHeaderLeft">Module</td>
249 <td class="secondaryTable mainTableHeader">Acceptable</td>
250 <td class="secondaryTable mainTableHeader">Unvisited SeqPts</td>
251 <td class="secondaryTable mainTableGraphHeader" colspan="2">Coverage</td>
252 </tr>
253 <xsl:call-template name="coverageDetailSecondary">
254 <xsl:with-param name="name" select="./@name" />
255 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
256 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
257 <xsl:with-param name="coverage" select="./@coverage" />
258 <xsl:with-param name="threshold" select="./@acceptable" />
259 </xsl:call-template>
260 <tr>
261 <td class="secondaryChildTable childTableHeader" colspan="5">Namespaces</td>
262 </tr>
263 <xsl:for-each select="./namespace">
264 <xsl:call-template name="coverageIndentedDetail">
265 <xsl:with-param name="name" select="./@name" />
266 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
267 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
268 <xsl:with-param name="coverage" select="./@coverage" />
269 <xsl:with-param name="threshold" select="./../@acceptable" />
270 </xsl:call-template>
271 </xsl:for-each>
272 </xsl:for-each>
273 </xsl:template>
274
275 <!-- Classes per Namespace per Module Summary -->
276 <xsl:template name="classModuleSummary">
277 <xsl:param name="threshold" />
278 <xsl:param name="unvisitedTitle" />
279 <xsl:param name="coverageTitle" />
280 <xsl:for-each select="./modules/module">
281 <tr>
282 <td colspan="5"> </td>
283 </tr>
284 <tr>
285 <td class="secondaryTable mainTableHeaderLeft">Module</td>
286 <td class="secondaryTable mainTableHeader">Acceptable</td>
287 <td class="secondaryTable mainTableHeader"><xsl:value-of select="$unvisitedTitle" /></td>
288 <td class="secondaryTable mainTableGraphHeader" colspan="2"><xsl:value-of select="$coverageTitle" /></td>
289 </tr>
290 <xsl:call-template name="coverageDetailSecondary">
291 <xsl:with-param name="name" select="./@name" />
292 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
293 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
294 <xsl:with-param name="coverage" select="./@coverage" />
295 <xsl:with-param name="threshold" select="./@acceptable" />
296 </xsl:call-template>
297 <tr>
298 <td class="secondaryChildTable childTableHeader" colspan="5">Namespace / Classes</td>
299 </tr>
300 <xsl:for-each select="./namespace">
301 <xsl:call-template name="coverageIndentedDetail">
302 <xsl:with-param name="name" select="./@name" />
303 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
304 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
305 <xsl:with-param name="coverage" select="./@coverage" />
306 <xsl:with-param name="threshold" select="../@acceptable" />
307 <xsl:with-param name="styleTweak">padding-left:20px;font-weight:bold</xsl:with-param>
308 </xsl:call-template>
309 <xsl:for-each select="./class">
310 <xsl:call-template name="coverageIndentedDetail">
311 <xsl:with-param name="name" select="./@name" />
312 <xsl:with-param name="unvisitedPoints" select="./@unvisitedPoints" />
313 <xsl:with-param name="sequencePoints" select="./@sequencePoints" />
314 <xsl:with-param name="coverage" select="./@coverage" />
315 <xsl:with-param name="threshold" select="../../@acceptable" />
316 <xsl:with-param name="styleTweak">padding-left:30px</xsl:with-param>
317 <xsl:with-param name="scale">160</xsl:with-param>
318 </xsl:call-template>
319 </xsl:for-each>
320 </xsl:for-each>
321 </xsl:for-each>
322 </xsl:template>
323
324 <!-- Coverage detail row in main grid displaying a name, statistics and graph bar -->
325 <xsl:template name="coverageDetail">
326 <xsl:param name="name" />
327 <xsl:param name="unvisitedPoints" />
328 <xsl:param name="sequencePoints" />
329 <xsl:param name="coverage" />
330 <xsl:param name="threshold" />
331 <xsl:param name="showThreshold" />
332 <tr>
333 <xsl:choose>
334 <xsl:when test="$showThreshold='True'">
335 <td class="mainTableCellBottom mainTableCellItem"><xsl:value-of select="$name" /></td>
336 <td class="mainTableCellBottom mainTableCellData"><xsl:value-of select="concat(format-number($threshold,'#0.0'), ' %')" /></td>
337 </xsl:when>
338 <xsl:otherwise>
339 <td class="mainTableCellBottom mainTableCellItem" colspan="2"><xsl:value-of select="$name" /></td>
340 </xsl:otherwise>
341 </xsl:choose>
342 <td class="mainTableCellBottom mainTableCellData"><xsl:value-of select="$unvisitedPoints" /></td>
343 <td class="mainTableCellBottom mainTableCellPercent"><xsl:value-of select="concat(format-number($coverage,'#0.0'), ' %')" /></td>
344 <td class="mainTableCellBottom mainTableCellGraph">
345 <xsl:call-template name="detailPercent">
346 <xsl:with-param name="notVisited" select="$unvisitedPoints" />
347 <xsl:with-param name="total" select="$sequencePoints" />
348 <xsl:with-param name="threshold" select="$threshold" />
349 <xsl:with-param name="scale" select="200" />
350 </xsl:call-template>
351 </td>
352 </tr>
353 </xsl:template>
354
355 <!-- Coverage detail row in secondary grid header displaying a name, statistics and graph bar -->
356 <xsl:template name="coverageDetailSecondary">
357 <xsl:param name="name" />
358 <xsl:param name="unvisitedPoints" />
359 <xsl:param name="sequencePoints" />
360 <xsl:param name="coverage" />
361 <xsl:param name="threshold" />
362 <tr>
363 <td class="mainTableCellItem"><xsl:value-of select="$name" /></td>
364 <td class="mainTableCellData"><xsl:value-of select="concat(format-number($threshold,'#0.0'), ' %')" /></td>
365 <td class="mainTableCellData"><xsl:value-of select="$unvisitedPoints" /></td>
366 <td class="mainTableCellPercent"><xsl:value-of select="concat(format-number($coverage,'#0.0'), ' %')" /></td>
367 <td class="mainTableCellGraph">
368 <xsl:call-template name="detailPercent">
369 <xsl:with-param name="notVisited" select="$unvisitedPoints" />
370 <xsl:with-param name="total" select="$sequencePoints" />
371 <xsl:with-param name="threshold" select="$threshold" />
372 <xsl:with-param name="scale" select="200" />
373 </xsl:call-template>
374 </td>
375 </tr>
376 </xsl:template>
377
378 <!-- Coverage detail row with indented item name and shrunk graph bar -->
379 <xsl:template name="coverageIndentedDetail">
380 <xsl:param name="name" />
381 <xsl:param name="unvisitedPoints" />
382 <xsl:param name="sequencePoints" />
383 <xsl:param name="coverage" />
384 <xsl:param name="threshold" />
385 <xsl:param name="styleTweak">padding-left:20px</xsl:param>
386 <xsl:param name="scale">180</xsl:param>
387 <tr>
388 <td class="mainTableCellBottom childTableCellIndentedItem" colspan="2"><xsl:attribute name="style"><xsl:value-of select="$styleTweak"/></xsl:attribute><xsl:value-of select="$name" /></td>
389 <td class="mainTableCellBottom mainTableCellData"><xsl:value-of select="$unvisitedPoints" /></td>
390 <td class="mainTableCellBottom mainTableCellPercent"><xsl:value-of select="concat(format-number($coverage,'#0.0'), ' %')" /></td>
391 <td class="mainTableCellBottom mainTableCellGraph">
392 <xsl:call-template name="detailPercent">
393 <xsl:with-param name="notVisited" select="$unvisitedPoints" />
394 <xsl:with-param name="total" select="$sequencePoints" />
395 <xsl:with-param name="threshold" select="$threshold" />
396 <xsl:with-param name="scale" select="$scale" />
397 </xsl:call-template>
398 </td>
399 </tr>
400 </xsl:template>
401
402 <!-- Exclusions Summary -->
403 <xsl:template name="exclusionsSummary">
404 <tr>
405 <td colspan="5"> </td>
406 </tr>
407 <tr>
408 <td class="exclusionTable mainTableHeaderLeft" colspan="3">Excluded From Coverage Results</td>
409 <td class="exclusionTable mainTableGraphHeader" colspan="2">All Code Within</td>
410 </tr>
411 <xsl:for-each select="./exclusions/exclusion">
412 <tr>
413 <td class="mainTableCellBottom exclusionTableCellItem" colspan="3"><xsl:value-of select="@name" /></td>
414 <td class="mainTableCellBottom mainTableCellGraph" colspan="2"><xsl:value-of select="@category" /></td>
415 </tr>
416 </xsl:for-each>
417 </xsl:template>
418
419 <!-- Footer -->
420 <xsl:template name="footer">
421 <tr>
422 <td colspan="5"> </td>
423 </tr>
424 </xsl:template>
425
426 <!-- Draw % Green/Red/Yellow Bar -->
427 <xsl:template name="detailPercent">
428 <xsl:param name="notVisited" />
429 <xsl:param name="total" />
430 <xsl:param name="threshold" />
431 <xsl:param name="scale" />
432 <xsl:variable name="visited" select="$total - $notVisited" />
433 <xsl:variable name="coverage" select="$visited div $total * 100"/>
434 <table cellpadding="0" cellspacing="0">
435 <tbody>
436 <tr>
437 <xsl:if test="$notVisited = 0">
438 <td class="graphBarVisitedFully" height="14">
439 <xsl:attribute name="width">
440 <xsl:value-of select="$scale" />
441 </xsl:attribute>.</td>
442 </xsl:if>
443 <xsl:if test="($visited != 0) and ($notVisited != 0)">
444 <td class="graphBarVisited" height="14">
445 <xsl:attribute name="width">
446 <xsl:value-of select="format-number($coverage div 100 * $scale, '0') - 1" />
447 </xsl:attribute>.</td>
448 </xsl:if>
449 <xsl:if test="$notVisited != 0">
450 <td height="14">
451 <xsl:attribute name="class">
452 <xsl:if test="$coverage >= $threshold">graphBarSatisfactory</xsl:if>
453 <xsl:if test="$coverage < $threshold">graphBarNotVisited</xsl:if>
454 </xsl:attribute>
455 <xsl:attribute name="width">
456 <xsl:value-of select="format-number($notVisited div $total * $scale, '0')" />
457 </xsl:attribute>.</td>
458 </xsl:if>
459 </tr>
460 </tbody>
461 </table>
462 </xsl:template>
463</xsl:stylesheet>