blob: 9cdd80e13f6571cd433eb5a25ae7e1f8f2afe53a [file] [log] [blame]
david_williams403beae2007-12-09 02:10:40 +00001<xsl:stylesheet
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version="1.0">
4 <xsl:output
5 method="html"
david_williams8e4dc9c2008-07-06 08:08:58 +00006 indent="yes"/>
david_williams403beae2007-12-09 02:10:40 +00007 <xsl:decimal-format
8 decimal-separator="."
david_williams8e4dc9c2008-07-06 08:08:58 +00009 grouping-separator=","/>
10 <xsl:template
11 match="testsuites">
david_williams403beae2007-12-09 02:10:40 +000012 <HTML>
13 <HEAD>
david_williams8e4dc9c2008-07-06 08:08:58 +000014 <style
david_williams2f43da22009-07-22 04:25:24 +000015 type="text/css"> body { font:normal 68%
16 verdana,arial,helvetica; color:#000000; } table tr
17 td, table tr th { font-size: 68%; } table.details tr
18 th{ font-weight: bold; text-align:left;
19 background:#a6caf0; } table.details tr td{
20 background:#eeeee0; } p { line-height:1.5em;
21 margin-top:0.5em; margin-bottom:1.0em; } h1 {
22 margin: 0px 0px 5px; font: 165%
23 verdana,arial,helvetica } h2 { margin-top: 1em;
24 margin-bottom: 0.5em; font: bold 125%
25 verdana,arial,helvetica } h3 { margin-bottom: 0.5em;
26 font: bold 115% verdana,arial,helvetica } h4 {
27 margin-bottom: 0.5em; font: bold 100%
david_williams403beae2007-12-09 02:10:40 +000028 verdana,arial,helvetica } h5 { margin-bottom: 0.5em;
29 font: bold 100% verdana,arial,helvetica } h6 {
30 margin-bottom: 0.5em; font: bold 100%
31 verdana,arial,helvetica } .Error { font-weight:bold;
32 color:red; } .Failure { font-weight:bold;
david_williams2f43da22009-07-22 04:25:24 +000033 color:purple; } .Properties { text-align:right; } </style>
34 <script
35 language="JavaScript">
david_williams403beae2007-12-09 02:10:40 +000036 var TestCases = new Array(); var cur;
david_williams2f43da22009-07-22 04:25:24 +000037 <xsl:for-each
38 select="./testsuite">
39 <xsl:apply-templates
40 select="properties"/>
david_williams403beae2007-12-09 02:10:40 +000041 </xsl:for-each>
david_williams403beae2007-12-09 02:10:40 +000042 </script>
david_williams2f43da22009-07-22 04:25:24 +000043 <script
44 language="JavaScript"><![CDATA[
ndaib8cedc82005-09-13 18:00:32 +000045 function displayProperties (name) {
46 var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
47 var doc = win.document.open();
48 doc.write("<html><head><title>Properties of " + name + "</title>");
49 doc.write("<style>")
50 doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
51 doc.write("table tr td, table tr th { font-size: 68%; }");
52 doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
53 doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
54 doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
55 doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }");
56 doc.write("</style>");
57 doc.write("</head><body>");
58 doc.write("<h3>Properties of " + name + "</h3>");
59 doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
60 doc.write("<table class='properties'>");
61 doc.write("<tr><th>Name</th><th>Value</th></tr>");
62 for (prop in TestCases[name]) {
63 doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>");
64 }
65 doc.write("</table>");
66 doc.write("</body></html>");
67 doc.close();
68 win.focus();
69 }
david_williams403beae2007-12-09 02:10:40 +000070 ]]>
71 </script>
72 </HEAD>
73 <body>
david_williams2f43da22009-07-22 04:25:24 +000074 <a
75 name="top"></a>
76 <xsl:call-template
77 name="pageHeader"/>
david_williams403beae2007-12-09 02:10:40 +000078
79 <!-- Summary part -->
david_williams2f43da22009-07-22 04:25:24 +000080 <xsl:call-template
81 name="summary"/>
david_williams403beae2007-12-09 02:10:40 +000082 <hr
83 size="1"
84 width="95%"
david_williams2f43da22009-07-22 04:25:24 +000085 align="left"/>
david_williams403beae2007-12-09 02:10:40 +000086
87 <!-- Package List part -->
david_williams2f43da22009-07-22 04:25:24 +000088 <xsl:call-template
89 name="packagelist"/>
david_williams403beae2007-12-09 02:10:40 +000090 <hr
91 size="1"
92 width="95%"
david_williams2f43da22009-07-22 04:25:24 +000093 align="left"/>
david_williams403beae2007-12-09 02:10:40 +000094
95 <!-- For each package create its part -->
david_williams2f43da22009-07-22 04:25:24 +000096 <xsl:call-template
97 name="packages"/>
david_williams403beae2007-12-09 02:10:40 +000098 <hr
99 size="1"
100 width="95%"
david_williams2f43da22009-07-22 04:25:24 +0000101 align="left"/>
david_williams403beae2007-12-09 02:10:40 +0000102
103 <!-- For each class create the part -->
david_williams2f43da22009-07-22 04:25:24 +0000104 <xsl:call-template
105 name="classes"/>
david_williams403beae2007-12-09 02:10:40 +0000106 </body>
107 </HTML>
108 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000109 <!--
110 ==================================================================
111 -->
112 <!--
113 Write a list of all packages with an hyperlink to the anchor of
114 -->
115 <!--
116 of the package name.
117 -->
118 <!--
119 ==================================================================
120 -->
121 <xsl:template
122 name="packagelist">
david_williams403beae2007-12-09 02:10:40 +0000123 <h2>Packages</h2>
124 Note: package statistics are not computed recursively, they only
125 sum up all of its testsuites numbers.
126 <table
127 class="details"
128 border="0"
129 cellpadding="5"
130 cellspacing="2"
131 width="95%">
david_williams2f43da22009-07-22 04:25:24 +0000132 <xsl:call-template
133 name="testsuite.test.header"/>
david_williams403beae2007-12-09 02:10:40 +0000134 <!-- list all packages recursively -->
135 <xsl:for-each
136 select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
david_williams2f43da22009-07-22 04:25:24 +0000137 <xsl:sort
138 select="@package"/>
david_williams403beae2007-12-09 02:10:40 +0000139 <xsl:variable
140 name="testsuites-in-package"
david_williams2f43da22009-07-22 04:25:24 +0000141 select="/testsuites/testsuite[./@package = current()/@package]"/>
david_williams403beae2007-12-09 02:10:40 +0000142 <xsl:variable
143 name="testCount"
david_williams2f43da22009-07-22 04:25:24 +0000144 select="sum($testsuites-in-package/@tests)"/>
david_williams403beae2007-12-09 02:10:40 +0000145 <xsl:variable
146 name="errorCount"
david_williams2f43da22009-07-22 04:25:24 +0000147 select="sum($testsuites-in-package/@errors)"/>
david_williams403beae2007-12-09 02:10:40 +0000148 <xsl:variable
149 name="failureCount"
david_williams2f43da22009-07-22 04:25:24 +0000150 select="sum($testsuites-in-package/@failures)"/>
david_williams403beae2007-12-09 02:10:40 +0000151 <xsl:variable
152 name="timeCount"
david_williams2f43da22009-07-22 04:25:24 +0000153 select="sum($testsuites-in-package/@time)"/>
david_williams403beae2007-12-09 02:10:40 +0000154
155 <!-- write a summary for the package -->
david_williams2f43da22009-07-22 04:25:24 +0000156 <tr
157 valign="top">
david_williams403beae2007-12-09 02:10:40 +0000158 <!-- set a nice color depending if there is an error/failure -->
david_williams2f43da22009-07-22 04:25:24 +0000159 <xsl:attribute
160 name="class">
ndaib8cedc82005-09-13 18:00:32 +0000161 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000162 <xsl:when
163 test="$failureCount &gt; 0">Failure</xsl:when>
164 <xsl:when
165 test="$errorCount &gt; 0">Error</xsl:when>
ndaib8cedc82005-09-13 18:00:32 +0000166 </xsl:choose>
167 </xsl:attribute>
david_williams403beae2007-12-09 02:10:40 +0000168 <td>
david_williams2f43da22009-07-22 04:25:24 +0000169 <a
170 href="#{@package}">
171 <xsl:value-of
172 select="@package"/>
david_williams403beae2007-12-09 02:10:40 +0000173 </a>
174 </td>
175 <td>
david_williams2f43da22009-07-22 04:25:24 +0000176 <xsl:value-of
177 select="$testCount"/>
david_williams403beae2007-12-09 02:10:40 +0000178 </td>
179 <td>
david_williams2f43da22009-07-22 04:25:24 +0000180 <xsl:value-of
181 select="$errorCount"/>
david_williams403beae2007-12-09 02:10:40 +0000182 </td>
183 <td>
david_williams2f43da22009-07-22 04:25:24 +0000184 <xsl:value-of
185 select="$failureCount"/>
david_williams403beae2007-12-09 02:10:40 +0000186 </td>
187 <td>
david_williams2f43da22009-07-22 04:25:24 +0000188 <xsl:call-template
189 name="display-time">
david_williams403beae2007-12-09 02:10:40 +0000190 <xsl:with-param
191 name="value"
david_williams2f43da22009-07-22 04:25:24 +0000192 select="$timeCount"/>
david_williams403beae2007-12-09 02:10:40 +0000193 </xsl:call-template>
194 </td>
195 </tr>
196 </xsl:for-each>
197 </table>
198 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000199 <!--
200 ==================================================================
201 -->
202 <!--
203 Write a package level report
204 -->
205 <!--
206 It creates a table with values from the document:
207 -->
208 <!--
209 Name | Tests | Errors | Failures | Time
210 -->
211 <!--
212 ==================================================================
213 -->
214 <xsl:template
215 name="packages">
david_williams403beae2007-12-09 02:10:40 +0000216 <!-- create an anchor to this package name -->
217 <xsl:for-each
218 select="/testsuites/testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
david_williams2f43da22009-07-22 04:25:24 +0000219 <xsl:sort
220 select="@package"/>
221 <a
222 name="{@package}"></a>
david_williams403beae2007-12-09 02:10:40 +0000223 <h3>
224 Package
david_williams2f43da22009-07-22 04:25:24 +0000225 <xsl:value-of
226 select="@package"/>
david_williams403beae2007-12-09 02:10:40 +0000227 </h3>
david_williams403beae2007-12-09 02:10:40 +0000228 <table
229 class="details"
230 border="0"
231 cellpadding="5"
232 cellspacing="2"
233 width="95%">
david_williams2f43da22009-07-22 04:25:24 +0000234 <xsl:call-template
235 name="testsuite.test.header"/>
david_williams403beae2007-12-09 02:10:40 +0000236
237 <!-- match the testsuites of this package -->
238 <xsl:apply-templates
239 select="/testsuites/testsuite[./@package = current()/@package]"
david_williams2f43da22009-07-22 04:25:24 +0000240 mode="print.test"/>
david_williams403beae2007-12-09 02:10:40 +0000241 </table>
david_williams2f43da22009-07-22 04:25:24 +0000242 <a
243 href="#top">Back to top</a>
244 <p/>
245 <p/>
david_williams403beae2007-12-09 02:10:40 +0000246 </xsl:for-each>
247 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000248 <xsl:template
249 name="classes">
250 <xsl:for-each
251 select="testsuite">
252 <xsl:sort
253 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000254 <!-- create an anchor to this class name -->
david_williams2f43da22009-07-22 04:25:24 +0000255 <a
256 name="{@name}"></a>
david_williams403beae2007-12-09 02:10:40 +0000257 <h3>
258 TestCase
david_williams2f43da22009-07-22 04:25:24 +0000259 <xsl:value-of
260 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000261 </h3>
david_williams403beae2007-12-09 02:10:40 +0000262 <table
263 class="details"
264 border="0"
265 cellpadding="5"
266 cellspacing="2"
267 width="95%">
david_williams2f43da22009-07-22 04:25:24 +0000268 <xsl:call-template
269 name="testcase.test.header"/>
david_williams403beae2007-12-09 02:10:40 +0000270 <!--
david_williams2f43da22009-07-22 04:25:24 +0000271 test can even not be started at all (failure to load
272 the class) so report the error directly
david_williams403beae2007-12-09 02:10:40 +0000273 -->
david_williams2f43da22009-07-22 04:25:24 +0000274 <xsl:if
275 test="./error">
276 <tr
277 class="Error">
278 <td
279 colspan="4">
280 <xsl:apply-templates
281 select="./error"/>
david_williams403beae2007-12-09 02:10:40 +0000282 </td>
283 </tr>
284 </xsl:if>
285 <xsl:apply-templates
286 select="./testcase"
david_williams2f43da22009-07-22 04:25:24 +0000287 mode="print.test"/>
david_williams403beae2007-12-09 02:10:40 +0000288 </table>
david_williams2f43da22009-07-22 04:25:24 +0000289 <div
290 class="Properties">
ndaib8cedc82005-09-13 18:00:32 +0000291 <a>
david_williams2f43da22009-07-22 04:25:24 +0000292 <xsl:attribute
293 name="href">javascript:displayProperties('<xsl:value-of
294 select="@package"/>.<xsl:value-of
295 select="@name"/>');</xsl:attribute>
david_williamsdb9eed92009-11-18 20:03:49 +0000296 Properties &gt;&gt;
297 </a>
ndaib8cedc82005-09-13 18:00:32 +0000298 </div>
david_williams2f43da22009-07-22 04:25:24 +0000299 <p/>
300 <a
301 href="#top">Back to top</a>
david_williams403beae2007-12-09 02:10:40 +0000302 </xsl:for-each>
303 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000304 <xsl:template
305 name="summary">
david_williams403beae2007-12-09 02:10:40 +0000306 <h2>Summary</h2>
307 <xsl:variable
308 name="testCount"
david_williams2f43da22009-07-22 04:25:24 +0000309 select="sum(testsuite/@tests)"/>
david_williams403beae2007-12-09 02:10:40 +0000310 <xsl:variable
311 name="errorCount"
david_williams2f43da22009-07-22 04:25:24 +0000312 select="sum(testsuite/@errors)"/>
david_williams403beae2007-12-09 02:10:40 +0000313 <xsl:variable
314 name="failureCount"
david_williams2f43da22009-07-22 04:25:24 +0000315 select="sum(testsuite/@failures)"/>
david_williams403beae2007-12-09 02:10:40 +0000316 <xsl:variable
317 name="timeCount"
david_williams2f43da22009-07-22 04:25:24 +0000318 select="sum(testsuite/@time)"/>
david_williams403beae2007-12-09 02:10:40 +0000319 <xsl:variable
320 name="successRate"
david_williams2f43da22009-07-22 04:25:24 +0000321 select="($testCount - $failureCount - $errorCount) div $testCount"/>
david_williams403beae2007-12-09 02:10:40 +0000322 <table
323 class="details"
324 border="0"
325 cellpadding="5"
326 cellspacing="2"
327 width="95%">
david_williams2f43da22009-07-22 04:25:24 +0000328 <tr
329 valign="top">
david_williams403beae2007-12-09 02:10:40 +0000330 <th>Tests</th>
331 <th>Failures</th>
332 <th>Errors</th>
333 <th>Success rate</th>
334 <th>Time</th>
335 </tr>
david_williams2f43da22009-07-22 04:25:24 +0000336 <tr
337 valign="top">
338 <xsl:attribute
339 name="class">
ndaib8cedc82005-09-13 18:00:32 +0000340 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000341 <xsl:when
342 test="$failureCount &gt; 0">Failure</xsl:when>
343 <xsl:when
344 test="$errorCount &gt; 0">Error</xsl:when>
ndaib8cedc82005-09-13 18:00:32 +0000345 </xsl:choose>
346 </xsl:attribute>
david_williams403beae2007-12-09 02:10:40 +0000347 <td>
david_williams2f43da22009-07-22 04:25:24 +0000348 <xsl:value-of
349 select="$testCount"/>
david_williams403beae2007-12-09 02:10:40 +0000350 </td>
351 <td>
david_williams2f43da22009-07-22 04:25:24 +0000352 <xsl:value-of
353 select="$failureCount"/>
david_williams403beae2007-12-09 02:10:40 +0000354 </td>
355 <td>
david_williams2f43da22009-07-22 04:25:24 +0000356 <xsl:value-of
357 select="$errorCount"/>
david_williams403beae2007-12-09 02:10:40 +0000358 </td>
359 <td>
david_williams2f43da22009-07-22 04:25:24 +0000360 <xsl:call-template
361 name="display-percent">
david_williams403beae2007-12-09 02:10:40 +0000362 <xsl:with-param
363 name="value"
david_williams2f43da22009-07-22 04:25:24 +0000364 select="$successRate"/>
david_williams403beae2007-12-09 02:10:40 +0000365 </xsl:call-template>
366 </td>
367 <td>
david_williams2f43da22009-07-22 04:25:24 +0000368 <xsl:call-template
369 name="display-time">
david_williams403beae2007-12-09 02:10:40 +0000370 <xsl:with-param
371 name="value"
david_williams2f43da22009-07-22 04:25:24 +0000372 select="$timeCount"/>
david_williams403beae2007-12-09 02:10:40 +0000373 </xsl:call-template>
374 </td>
david_williams403beae2007-12-09 02:10:40 +0000375 </tr>
376 </table>
377 <table
378 border="0"
379 width="95%">
380 <tr>
david_williams2f43da22009-07-22 04:25:24 +0000381 <td
382 style="text-align: justify;">
david_williams403beae2007-12-09 02:10:40 +0000383 Note:
384 <i>failures</i>
385 are anticipated and checked for with assertions
386 while
387 <i>errors</i>
388 are unanticipated.
389 </td>
390 </tr>
391 </table>
392 </xsl:template>
david_williams403beae2007-12-09 02:10:40 +0000393 <!--
david_williams2f43da22009-07-22 04:25:24 +0000394 Write properties into a JavaScript data structure. This is based
395 on the original idea by Erik Hatcher (erik@hatcher.net)
david_williams403beae2007-12-09 02:10:40 +0000396 -->
david_williams2f43da22009-07-22 04:25:24 +0000397 <xsl:template
398 match="properties">
david_williams403beae2007-12-09 02:10:40 +0000399 cur = TestCases['
david_williams2f43da22009-07-22 04:25:24 +0000400 <xsl:value-of
401 select="../@package"/>
david_williams403beae2007-12-09 02:10:40 +0000402 .
david_williams2f43da22009-07-22 04:25:24 +0000403 <xsl:value-of
404 select="../@name"/>
david_williams403beae2007-12-09 02:10:40 +0000405 '] = new Array();
david_williams2f43da22009-07-22 04:25:24 +0000406 <xsl:for-each
407 select="property">
408 <xsl:sort
409 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000410 cur['
david_williams2f43da22009-07-22 04:25:24 +0000411 <xsl:value-of
412 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000413 '] = '
david_williams2f43da22009-07-22 04:25:24 +0000414 <xsl:call-template
415 name="JS-escape">
david_williams403beae2007-12-09 02:10:40 +0000416 <xsl:with-param
417 name="string"
david_williams2f43da22009-07-22 04:25:24 +0000418 select="@value"/>
david_williams403beae2007-12-09 02:10:40 +0000419 </xsl:call-template>
420 ';
421 </xsl:for-each>
422 </xsl:template>
ndaib8cedc82005-09-13 18:00:32 +0000423
david_williams403beae2007-12-09 02:10:40 +0000424 <!-- Page HEADER -->
david_williams2f43da22009-07-22 04:25:24 +0000425 <xsl:template
426 name="pageHeader">
david_williams403beae2007-12-09 02:10:40 +0000427 <h1>Unit Test Results</h1>
david_williams2f43da22009-07-22 04:25:24 +0000428 <table
429 width="100%">
david_williams403beae2007-12-09 02:10:40 +0000430 <tr>
david_williams2f43da22009-07-22 04:25:24 +0000431 <td
432 align="left"></td>
433 <td
434 align="right">
david_williams403beae2007-12-09 02:10:40 +0000435 Designed for use with
david_williams2f43da22009-07-22 04:25:24 +0000436 <a
437 href='http://www.junit.org'>JUnit</a>
david_williams403beae2007-12-09 02:10:40 +0000438 and
david_williams2f43da22009-07-22 04:25:24 +0000439 <a
440 href='http://jakarta.apache.org/ant'>Ant</a>
david_williams403beae2007-12-09 02:10:40 +0000441 .
442 </td>
443 </tr>
444 </table>
david_williams2f43da22009-07-22 04:25:24 +0000445 <hr
446 size="1"/>
david_williams403beae2007-12-09 02:10:40 +0000447 </xsl:template>
david_williams403beae2007-12-09 02:10:40 +0000448 <xsl:template
449 match="testsuite"
450 mode="header">
david_williams2f43da22009-07-22 04:25:24 +0000451 <tr
452 valign="top">
453 <th
454 width="80%">Name</th>
david_williams403beae2007-12-09 02:10:40 +0000455 <th>Tests</th>
456 <th>Errors</th>
457 <th>Failures</th>
david_williams2f43da22009-07-22 04:25:24 +0000458 <th
459 nowrap="nowrap">Time(s)</th>
david_williams403beae2007-12-09 02:10:40 +0000460 </tr>
461 </xsl:template>
462
463 <!-- class header -->
david_williams2f43da22009-07-22 04:25:24 +0000464 <xsl:template
465 name="testsuite.test.header">
466 <tr
467 valign="top">
468 <th
469 width="80%">Name</th>
david_williams403beae2007-12-09 02:10:40 +0000470 <th>Tests</th>
471 <th>Errors</th>
472 <th>Failures</th>
david_williams2f43da22009-07-22 04:25:24 +0000473 <th
474 nowrap="nowrap">Time(s)</th>
david_williams403beae2007-12-09 02:10:40 +0000475 </tr>
476 </xsl:template>
477
478 <!-- method header -->
david_williams2f43da22009-07-22 04:25:24 +0000479 <xsl:template
480 name="testcase.test.header">
481 <tr
482 valign="top">
david_williams403beae2007-12-09 02:10:40 +0000483 <th>Name</th>
484 <th>Status</th>
david_williams2f43da22009-07-22 04:25:24 +0000485 <th
486 width="80%">Type</th>
487 <th
488 nowrap="nowrap">Time(s)</th>
david_williams403beae2007-12-09 02:10:40 +0000489 </tr>
490 </xsl:template>
ndaib8cedc82005-09-13 18:00:32 +0000491
492
david_williams403beae2007-12-09 02:10:40 +0000493 <!-- class information -->
494 <xsl:template
495 match="testsuite"
496 mode="print.test">
david_williams2f43da22009-07-22 04:25:24 +0000497 <tr
498 valign="top">
david_williams403beae2007-12-09 02:10:40 +0000499 <!-- set a nice color depending if there is an error/failure -->
david_williams2f43da22009-07-22 04:25:24 +0000500 <xsl:attribute
501 name="class">
ndaib8cedc82005-09-13 18:00:32 +0000502 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000503 <xsl:when
504 test="@failures[.&gt; 0]">Failure</xsl:when>
505 <xsl:when
506 test="@errors[.&gt; 0]">Error</xsl:when>
ndaib8cedc82005-09-13 18:00:32 +0000507 </xsl:choose>
508 </xsl:attribute>
ndaib8cedc82005-09-13 18:00:32 +0000509
david_williams403beae2007-12-09 02:10:40 +0000510 <!-- print testsuite information -->
511 <td>
david_williams2f43da22009-07-22 04:25:24 +0000512 <a
513 href="#{@name}">
514 <xsl:value-of
515 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000516 </a>
517 </td>
518 <td>
david_williams2f43da22009-07-22 04:25:24 +0000519 <xsl:value-of
520 select="@tests"/>
david_williams403beae2007-12-09 02:10:40 +0000521 </td>
522 <td>
david_williams2f43da22009-07-22 04:25:24 +0000523 <xsl:value-of
524 select="@errors"/>
david_williams403beae2007-12-09 02:10:40 +0000525 </td>
526 <td>
david_williams2f43da22009-07-22 04:25:24 +0000527 <xsl:value-of
528 select="@failures"/>
david_williams403beae2007-12-09 02:10:40 +0000529 </td>
530 <td>
david_williams2f43da22009-07-22 04:25:24 +0000531 <xsl:call-template
532 name="display-time">
david_williams403beae2007-12-09 02:10:40 +0000533 <xsl:with-param
534 name="value"
david_williams2f43da22009-07-22 04:25:24 +0000535 select="@time"/>
david_williams403beae2007-12-09 02:10:40 +0000536 </xsl:call-template>
537 </td>
538 </tr>
539 </xsl:template>
david_williams403beae2007-12-09 02:10:40 +0000540 <xsl:template
541 match="testcase"
542 mode="print.test">
david_williams2f43da22009-07-22 04:25:24 +0000543 <tr
544 valign="top">
545 <xsl:attribute
546 name="class">
ndaib8cedc82005-09-13 18:00:32 +0000547 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000548 <xsl:when
549 test="failure | error">Error</xsl:when>
ndaib8cedc82005-09-13 18:00:32 +0000550 </xsl:choose>
551 </xsl:attribute>
david_williams403beae2007-12-09 02:10:40 +0000552 <td>
david_williams2f43da22009-07-22 04:25:24 +0000553 <xsl:value-of
554 select="@name"/>
david_williams403beae2007-12-09 02:10:40 +0000555 </td>
556 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000557 <xsl:when
558 test="failure">
david_williams403beae2007-12-09 02:10:40 +0000559 <td>Failure</td>
560 <td>
david_williams2f43da22009-07-22 04:25:24 +0000561 <xsl:apply-templates
562 select="failure"/>
david_williams403beae2007-12-09 02:10:40 +0000563 </td>
564 </xsl:when>
david_williams2f43da22009-07-22 04:25:24 +0000565 <xsl:when
566 test="error">
david_williams403beae2007-12-09 02:10:40 +0000567 <td>Error</td>
568 <td>
david_williams2f43da22009-07-22 04:25:24 +0000569 <xsl:apply-templates
570 select="error"/>
david_williams403beae2007-12-09 02:10:40 +0000571 </td>
572 </xsl:when>
573 <xsl:otherwise>
574 <td>Success</td>
575 <td></td>
576 </xsl:otherwise>
577 </xsl:choose>
578 <td>
david_williams2f43da22009-07-22 04:25:24 +0000579 <xsl:call-template
580 name="display-time">
david_williams403beae2007-12-09 02:10:40 +0000581 <xsl:with-param
582 name="value"
david_williams2f43da22009-07-22 04:25:24 +0000583 select="@time"/>
david_williams403beae2007-12-09 02:10:40 +0000584 </xsl:call-template>
585 </td>
586 </tr>
587 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000588 <xsl:template
589 match="failure">
590 <xsl:call-template
591 name="display-failures"/>
david_williams403beae2007-12-09 02:10:40 +0000592 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000593 <xsl:template
594 match="error">
595 <xsl:call-template
596 name="display-failures"/>
david_williams403beae2007-12-09 02:10:40 +0000597 </xsl:template>
ndaib8cedc82005-09-13 18:00:32 +0000598
david_williams403beae2007-12-09 02:10:40 +0000599 <!-- Style for the error and failure in the tescase template -->
david_williams2f43da22009-07-22 04:25:24 +0000600 <xsl:template
601 name="display-failures">
david_williams403beae2007-12-09 02:10:40 +0000602 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000603 <xsl:when
604 test="not(@message)">
605 N/A
606 </xsl:when>
david_williams403beae2007-12-09 02:10:40 +0000607 <xsl:otherwise>
david_williams2f43da22009-07-22 04:25:24 +0000608 <xsl:value-of
609 select="@message"/>
david_williams403beae2007-12-09 02:10:40 +0000610 </xsl:otherwise>
611 </xsl:choose>
612 <!-- display the stacktrace -->
613 <code>
david_williams2f43da22009-07-22 04:25:24 +0000614 <p/>
615 <xsl:call-template
616 name="br-replace">
david_williams403beae2007-12-09 02:10:40 +0000617 <xsl:with-param
618 name="word"
david_williams2f43da22009-07-22 04:25:24 +0000619 select="."/>
david_williams403beae2007-12-09 02:10:40 +0000620 </xsl:call-template>
621 </code>
david_williams2f43da22009-07-22 04:25:24 +0000622 <!--
623 the later is better but might be problematic for non-21"
624 monitors...
625 -->
david_williams403beae2007-12-09 02:10:40 +0000626 <!--pre><xsl:value-of select="."/></pre-->
627 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000628 <xsl:template
629 name="JS-escape">
630 <xsl:param
631 name="string"/>
david_williams403beae2007-12-09 02:10:40 +0000632 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000633 <!--
634 something isn't right here, basically all single quotes
635 need to be replaced with backslash-single-quote
david_williams403beae2007-12-09 02:10:40 +0000636 <xsl:when test="contains($string,'&apos;')">
david_williams2f43da22009-07-22 04:25:24 +0000637 <xsl:value-of
638 select="substring-before($string,'&apos;')"/> \&apos;
639 <xsl:call-template name="JS-escape"> <xsl:with-param
640 name="string"
641 select="substring-after($string,'&apos;')"/>
642 </xsl:call-template> </xsl:when>
643 -->
644 <xsl:when
645 test="contains($string,'\')">
646 <xsl:value-of
647 select="substring-before($string,'\')"/>
david_williams403beae2007-12-09 02:10:40 +0000648 \\
david_williams2f43da22009-07-22 04:25:24 +0000649 <xsl:call-template
650 name="JS-escape">
david_williams403beae2007-12-09 02:10:40 +0000651 <xsl:with-param
652 name="string"
david_williams2f43da22009-07-22 04:25:24 +0000653 select="substring-after($string,'\')"/>
david_williams403beae2007-12-09 02:10:40 +0000654 </xsl:call-template>
655 </xsl:when>
656 <xsl:otherwise>
david_williams2f43da22009-07-22 04:25:24 +0000657 <xsl:value-of
658 select="$string"/>
david_williams403beae2007-12-09 02:10:40 +0000659 </xsl:otherwise>
660 </xsl:choose>
661 </xsl:template>
david_williams403beae2007-12-09 02:10:40 +0000662 <!--
663 template that will convert a carriage return into a br tag
664 @param word the text from which to convert CR to BR tag
665 -->
david_williams2f43da22009-07-22 04:25:24 +0000666 <xsl:template
667 name="br-replace">
668 <xsl:param
669 name="word"/>
david_williams403beae2007-12-09 02:10:40 +0000670 <xsl:choose>
david_williams2f43da22009-07-22 04:25:24 +0000671 <xsl:when
672 test="contains($word,'&#xA;')">
673 <xsl:value-of
674 select="substring-before($word,'&#xA;')"/>
675 <br/>
676 <xsl:call-template
677 name="br-replace">
david_williams403beae2007-12-09 02:10:40 +0000678 <xsl:with-param
679 name="word"
david_williams2f43da22009-07-22 04:25:24 +0000680 select="substring-after($word,'&#xA;')"/>
david_williams403beae2007-12-09 02:10:40 +0000681 </xsl:call-template>
682 </xsl:when>
683 <xsl:otherwise>
david_williams2f43da22009-07-22 04:25:24 +0000684 <xsl:value-of
685 select="$word"/>
david_williams403beae2007-12-09 02:10:40 +0000686 </xsl:otherwise>
687 </xsl:choose>
688 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000689 <xsl:template
690 name="display-time">
691 <xsl:param
692 name="value"/>
693 <xsl:value-of
694 select="format-number($value,'0.000')"/>
david_williams403beae2007-12-09 02:10:40 +0000695 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000696 <xsl:template
697 name="display-percent">
698 <xsl:param
699 name="value"/>
700 <xsl:value-of
701 select="format-number($value,'0.00%')"/>
david_williams403beae2007-12-09 02:10:40 +0000702 </xsl:template>
david_williams2f43da22009-07-22 04:25:24 +0000703</xsl:stylesheet>