1 | <?xml version="1.0"?>
|
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
---|
3 | xmlns:lxslt="http://xml.apache.org/xslt"
|
---|
4 | xmlns:redirect="http://xml.apache.org/xalan/redirect"
|
---|
5 | xmlns:string="xalan://java.lang.String"
|
---|
6 | extension-element-prefixes="redirect">
|
---|
7 | <xsl:output method="html" indent="yes" encoding="UTF-8"/>
|
---|
8 | <xsl:decimal-format decimal-separator="." grouping-separator=","/>
|
---|
9 | <!--
|
---|
10 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
11 | contributor license agreements. See the NOTICE file distributed with
|
---|
12 | this work for additional information regarding copyright ownership.
|
---|
13 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
14 | (the "License"); you may not use this file except in compliance with
|
---|
15 | the License. You may obtain a copy of the License at
|
---|
16 |
|
---|
17 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
18 |
|
---|
19 | Unless required by applicable law or agreed to in writing, software
|
---|
20 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
22 | See the License for the specific language governing permissions and
|
---|
23 | limitations under the License.
|
---|
24 | -->
|
---|
25 |
|
---|
26 | <!--
|
---|
27 |
|
---|
28 | Sample stylesheet to be used with Ant JUnitReport output.
|
---|
29 |
|
---|
30 | It creates a set of HTML files a la javadoc where you can browse easily
|
---|
31 | through all packages and classes.
|
---|
32 |
|
---|
33 | -->
|
---|
34 | <xsl:param name="output.dir" select="'.'"/>
|
---|
35 | <xsl:param name="TITLE">Unit Test Results.</xsl:param>
|
---|
36 |
|
---|
37 |
|
---|
38 | <xsl:template match="testsuites">
|
---|
39 | <!-- create the index.html -->
|
---|
40 | <redirect:write file="{$output.dir}/index.html">
|
---|
41 | <xsl:call-template name="index.html"/>
|
---|
42 | </redirect:write>
|
---|
43 |
|
---|
44 | <!-- create the stylesheet.css -->
|
---|
45 | <redirect:write file="{$output.dir}/stylesheet.css">
|
---|
46 | <xsl:call-template name="stylesheet.css"/>
|
---|
47 | </redirect:write>
|
---|
48 |
|
---|
49 | <!-- create the overview-packages.html at the root -->
|
---|
50 | <redirect:write file="{$output.dir}/overview-summary.html">
|
---|
51 | <xsl:apply-templates select="." mode="overview.packages"/>
|
---|
52 | </redirect:write>
|
---|
53 |
|
---|
54 | <!-- create the all-packages.html at the root -->
|
---|
55 | <redirect:write file="{$output.dir}/overview-frame.html">
|
---|
56 | <xsl:apply-templates select="." mode="all.packages"/>
|
---|
57 | </redirect:write>
|
---|
58 |
|
---|
59 | <!-- create the all-classes.html at the root -->
|
---|
60 | <redirect:write file="{$output.dir}/allclasses-frame.html">
|
---|
61 | <xsl:apply-templates select="." mode="all.classes"/>
|
---|
62 | </redirect:write>
|
---|
63 |
|
---|
64 | <!-- create the all-tests.html at the root -->
|
---|
65 | <redirect:write file="{$output.dir}/all-tests.html">
|
---|
66 | <xsl:apply-templates select="." mode="all.tests"/>
|
---|
67 | </redirect:write>
|
---|
68 |
|
---|
69 | <!-- create the alltests-fails.html at the root -->
|
---|
70 | <redirect:write file="{$output.dir}/alltests-fails.html">
|
---|
71 | <xsl:apply-templates select="." mode="all.tests">
|
---|
72 | <xsl:with-param name="type" select="'fails'"/>
|
---|
73 | </xsl:apply-templates>
|
---|
74 | </redirect:write>
|
---|
75 |
|
---|
76 | <!-- create the alltests-errors.html at the root -->
|
---|
77 | <redirect:write file="{$output.dir}/alltests-errors.html">
|
---|
78 | <xsl:apply-templates select="." mode="all.tests">
|
---|
79 | <xsl:with-param name="type" select="'errors'"/>
|
---|
80 | </xsl:apply-templates>
|
---|
81 | </redirect:write>
|
---|
82 |
|
---|
83 | <!-- create the alltests-skipped.html at the root -->
|
---|
84 | <redirect:write file="{$output.dir}/alltests-skipped.html">
|
---|
85 | <xsl:apply-templates select="." mode="all.tests">
|
---|
86 | <xsl:with-param name="type" select="'skipped'"/>
|
---|
87 | </xsl:apply-templates>
|
---|
88 | </redirect:write>
|
---|
89 |
|
---|
90 | <!-- process all packages -->
|
---|
91 | <xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
|
---|
92 | <xsl:call-template name="package">
|
---|
93 | <xsl:with-param name="name" select="@package"/>
|
---|
94 | </xsl:call-template>
|
---|
95 | </xsl:for-each>
|
---|
96 | </xsl:template>
|
---|
97 |
|
---|
98 |
|
---|
99 | <xsl:template name="package">
|
---|
100 | <xsl:param name="name"/>
|
---|
101 | <xsl:variable name="package.dir">
|
---|
102 | <xsl:if test="not($name = '')"><xsl:value-of select="translate($name,'.','/')"/></xsl:if>
|
---|
103 | <xsl:if test="$name = ''">.</xsl:if>
|
---|
104 | </xsl:variable>
|
---|
105 | <!--Processing package <xsl:value-of select="@name"/> in <xsl:value-of select="$output.dir"/> -->
|
---|
106 | <!-- create a classes-list.html in the package directory -->
|
---|
107 | <redirect:write file="{$output.dir}/{$package.dir}/package-frame.html">
|
---|
108 | <xsl:call-template name="classes.list">
|
---|
109 | <xsl:with-param name="name" select="$name"/>
|
---|
110 | </xsl:call-template>
|
---|
111 | </redirect:write>
|
---|
112 |
|
---|
113 | <!-- create a package-summary.html in the package directory -->
|
---|
114 | <redirect:write file="{$output.dir}/{$package.dir}/package-summary.html">
|
---|
115 | <xsl:call-template name="package.summary">
|
---|
116 | <xsl:with-param name="name" select="$name"/>
|
---|
117 | </xsl:call-template>
|
---|
118 | </redirect:write>
|
---|
119 |
|
---|
120 | <!-- for each class, creates a @name.html -->
|
---|
121 | <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
|
---|
122 | <xsl:for-each select="/testsuites/testsuite[@package = $name]">
|
---|
123 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}.html">
|
---|
124 | <xsl:apply-templates select="." mode="class.details"/>
|
---|
125 | </redirect:write>
|
---|
126 | <xsl:if test="string-length(./system-out)!=0">
|
---|
127 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-out.html">
|
---|
128 | <html>
|
---|
129 | <head>
|
---|
130 | <title>Standard Output from <xsl:value-of select="@name"/></title>
|
---|
131 | </head>
|
---|
132 | <body>
|
---|
133 | <pre><xsl:value-of select="./system-out"/></pre>
|
---|
134 | </body>
|
---|
135 | </html>
|
---|
136 | </redirect:write>
|
---|
137 | </xsl:if>
|
---|
138 | <xsl:if test="string-length(./system-err)!=0">
|
---|
139 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-err.html">
|
---|
140 | <html>
|
---|
141 | <head>
|
---|
142 | <title>Standard Error from <xsl:value-of select="@name"/></title>
|
---|
143 | </head>
|
---|
144 | <body>
|
---|
145 | <pre><xsl:value-of select="./system-err"/></pre>
|
---|
146 | </body>
|
---|
147 | </html>
|
---|
148 | </redirect:write>
|
---|
149 | </xsl:if>
|
---|
150 | <xsl:if test="@failures != 0">
|
---|
151 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-fails.html">
|
---|
152 | <xsl:apply-templates select="." mode="class.details">
|
---|
153 | <xsl:with-param name="type" select="'fails'"/>
|
---|
154 | </xsl:apply-templates>
|
---|
155 | </redirect:write>
|
---|
156 | </xsl:if>
|
---|
157 | <xsl:if test="@errors != 0">
|
---|
158 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-errors.html">
|
---|
159 | <xsl:apply-templates select="." mode="class.details">
|
---|
160 | <xsl:with-param name="type" select="'errors'"/>
|
---|
161 | </xsl:apply-templates>
|
---|
162 | </redirect:write>
|
---|
163 | </xsl:if>
|
---|
164 | <xsl:if test="@skipped != 0">
|
---|
165 | <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-skipped.html">
|
---|
166 | <xsl:apply-templates select="." mode="class.details">
|
---|
167 | <xsl:with-param name="type" select="'skipped'"/>
|
---|
168 | </xsl:apply-templates>
|
---|
169 | </redirect:write>
|
---|
170 | </xsl:if>
|
---|
171 | </xsl:for-each>
|
---|
172 | </xsl:template>
|
---|
173 |
|
---|
174 | <xsl:template name="index.html">
|
---|
175 | <html>
|
---|
176 | <head>
|
---|
177 | <title><xsl:value-of select="$TITLE"/></title>
|
---|
178 | </head>
|
---|
179 | <frameset cols="20%,80%">
|
---|
180 | <frameset rows="30%,70%">
|
---|
181 | <frame src="overview-frame.html" name="packageListFrame"/>
|
---|
182 | <frame src="allclasses-frame.html" name="classListFrame"/>
|
---|
183 | </frameset>
|
---|
184 | <frame src="overview-summary.html" name="classFrame"/>
|
---|
185 | <noframes>
|
---|
186 | <h2>Frame Alert</h2>
|
---|
187 | <p>
|
---|
188 | 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.
|
---|
189 | </p>
|
---|
190 | </noframes>
|
---|
191 | </frameset>
|
---|
192 | </html>
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 | <!-- this is the stylesheet css to use for nearly everything -->
|
---|
196 | <xsl:template name="stylesheet.css">
|
---|
197 | body {
|
---|
198 | font:normal 68% verdana,arial,helvetica;
|
---|
199 | color:#000000;
|
---|
200 | }
|
---|
201 | table tr td, table tr th {
|
---|
202 | font-size: 68%;
|
---|
203 | }
|
---|
204 | table.details tr th{
|
---|
205 | font-weight: bold;
|
---|
206 | text-align:left;
|
---|
207 | background:#a6caf0;
|
---|
208 | }
|
---|
209 | table.details tr td{
|
---|
210 | background:#eeeee0;
|
---|
211 | }
|
---|
212 |
|
---|
213 | p {
|
---|
214 | line-height:1.5em;
|
---|
215 | margin-top:0.5em; margin-bottom:1.0em;
|
---|
216 | }
|
---|
217 | h1 {
|
---|
218 | margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
|
---|
219 | }
|
---|
220 | h2 {
|
---|
221 | margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
|
---|
222 | }
|
---|
223 | h3 {
|
---|
224 | margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
|
---|
225 | }
|
---|
226 | h4 {
|
---|
227 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
228 | }
|
---|
229 | h5 {
|
---|
230 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
231 | }
|
---|
232 | h6 {
|
---|
233 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
234 | }
|
---|
235 | .Error {
|
---|
236 | font-weight:bold; color:red;
|
---|
237 | }
|
---|
238 | .Failure {
|
---|
239 | font-weight:bold; color:purple;
|
---|
240 | }
|
---|
241 | .Properties {
|
---|
242 | text-align:right;
|
---|
243 | }
|
---|
244 | </xsl:template>
|
---|
245 |
|
---|
246 | <!-- Create list of all/failed/errored/skipped tests -->
|
---|
247 | <xsl:template match="testsuites" mode="all.tests">
|
---|
248 | <xsl:param name="type" select="'all'"/>
|
---|
249 | <html>
|
---|
250 | <xsl:variable name="title">
|
---|
251 | <xsl:choose>
|
---|
252 | <xsl:when test="$type = 'fails'">
|
---|
253 | <xsl:text>All Failures</xsl:text>
|
---|
254 | </xsl:when>
|
---|
255 | <xsl:when test="$type = 'errors'">
|
---|
256 | <xsl:text>All Errors</xsl:text>
|
---|
257 | </xsl:when>
|
---|
258 | <xsl:when test="$type = 'skipped'">
|
---|
259 | <xsl:text>All Skipped</xsl:text>
|
---|
260 | </xsl:when>
|
---|
261 | <xsl:otherwise>
|
---|
262 | <xsl:text>All Tests</xsl:text>
|
---|
263 | </xsl:otherwise>
|
---|
264 | </xsl:choose>
|
---|
265 | </xsl:variable>
|
---|
266 | <head>
|
---|
267 | <title>Unit Test Results: <xsl:value-of select="$title"/></title>
|
---|
268 | <xsl:call-template name="create.stylesheet.link">
|
---|
269 | <xsl:with-param name="package.name"/>
|
---|
270 | </xsl:call-template>
|
---|
271 | </head>
|
---|
272 | <body>
|
---|
273 | <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
|
---|
274 | <xsl:call-template name="pageHeader"/>
|
---|
275 | <h2><xsl:value-of select="$title"/></h2>
|
---|
276 |
|
---|
277 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
278 | <xsl:call-template name="testcase.test.header">
|
---|
279 | <xsl:with-param name="show.class" select="'yes'"/>
|
---|
280 | </xsl:call-template>
|
---|
281 | <!--
|
---|
282 | test can even not be started at all (failure to load the class)
|
---|
283 | so report the error directly
|
---|
284 | -->
|
---|
285 | <xsl:if test="./error">
|
---|
286 | <tr class="Error">
|
---|
287 | <td colspan="4">
|
---|
288 | <xsl:apply-templates select="./error"/>
|
---|
289 | </td>
|
---|
290 | </tr>
|
---|
291 | </xsl:if>
|
---|
292 | <xsl:choose>
|
---|
293 | <xsl:when test="$type = 'fails'">
|
---|
294 | <xsl:apply-templates select=".//testcase[failure]" mode="print.test">
|
---|
295 | <xsl:with-param name="show.class" select="'yes'"/>
|
---|
296 | </xsl:apply-templates>
|
---|
297 | </xsl:when>
|
---|
298 | <xsl:when test="$type = 'errors'">
|
---|
299 | <xsl:apply-templates select=".//testcase[error]" mode="print.test">
|
---|
300 | <xsl:with-param name="show.class" select="'yes'"/>
|
---|
301 | </xsl:apply-templates>
|
---|
302 | </xsl:when>
|
---|
303 | <xsl:when test="$type = 'skipped'">
|
---|
304 | <xsl:apply-templates select=".//testcase[skipped]" mode="print.test">
|
---|
305 | <xsl:with-param name="show.class" select="'yes'"/>
|
---|
306 | </xsl:apply-templates>
|
---|
307 | </xsl:when>
|
---|
308 | <xsl:otherwise>
|
---|
309 | <xsl:apply-templates select=".//testcase" mode="print.test">
|
---|
310 | <xsl:with-param name="show.class" select="'yes'"/>
|
---|
311 | </xsl:apply-templates>
|
---|
312 | </xsl:otherwise>
|
---|
313 | </xsl:choose>
|
---|
314 | </table>
|
---|
315 | </body>
|
---|
316 | </html>
|
---|
317 | </xsl:template>
|
---|
318 |
|
---|
319 |
|
---|
320 | <!-- ======================================================================
|
---|
321 | This page is created for every testsuite class.
|
---|
322 | It prints a summary of the testsuite and detailed information about
|
---|
323 | testcase methods.
|
---|
324 | ====================================================================== -->
|
---|
325 | <xsl:template match="testsuite" mode="class.details">
|
---|
326 | <xsl:param name="type" select="'all'"/>
|
---|
327 | <xsl:variable name="package.name" select="@package"/>
|
---|
328 | <xsl:variable name="class.name"><xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></xsl:variable>
|
---|
329 | <html>
|
---|
330 | <head>
|
---|
331 | <title>Unit Test Results: <xsl:value-of select="$class.name"/></title>
|
---|
332 | <xsl:call-template name="create.stylesheet.link">
|
---|
333 | <xsl:with-param name="package.name" select="$package.name"/>
|
---|
334 | </xsl:call-template>
|
---|
335 | <script type="text/javascript" language="JavaScript">
|
---|
336 | var TestCases = new Array();
|
---|
337 | var cur;
|
---|
338 | <xsl:apply-templates select="properties"/>
|
---|
339 | </script>
|
---|
340 | <script type="text/javascript" language="JavaScript"><![CDATA[
|
---|
341 | function displayProperties (name) {
|
---|
342 | var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
|
---|
343 | var doc = win.document;
|
---|
344 | doc.open();
|
---|
345 | doc.write("<html><head><title>Properties of " + name + "</title>");
|
---|
346 | doc.write("<style type=\"text/css\">");
|
---|
347 | doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
|
---|
348 | doc.write("table tr td, table tr th { font-size: 68%; }");
|
---|
349 | doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
|
---|
350 | doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
|
---|
351 | doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
|
---|
352 | doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }");
|
---|
353 | doc.write("</style>");
|
---|
354 | doc.write("</head><body>");
|
---|
355 | doc.write("<h3>Properties of " + name + "</h3>");
|
---|
356 | doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
|
---|
357 | doc.write("<table class='properties'>");
|
---|
358 | doc.write("<tr><th>Name</th><th>Value</th></tr>");
|
---|
359 | for (prop in TestCases[name]) {
|
---|
360 | doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>");
|
---|
361 | }
|
---|
362 | doc.write("</table>");
|
---|
363 | doc.write("</body></html>");
|
---|
364 | doc.close();
|
---|
365 | win.focus();
|
---|
366 | }
|
---|
367 | ]]>
|
---|
368 | </script>
|
---|
369 | </head>
|
---|
370 | <body>
|
---|
371 | <xsl:call-template name="pageHeader"/>
|
---|
372 | <h3>Class <xsl:value-of select="$class.name"/></h3>
|
---|
373 |
|
---|
374 |
|
---|
375 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
376 | <xsl:call-template name="testsuite.test.header"/>
|
---|
377 | <xsl:apply-templates select="." mode="print.test"/>
|
---|
378 | </table>
|
---|
379 |
|
---|
380 | <xsl:choose>
|
---|
381 | <xsl:when test="$type = 'fails'">
|
---|
382 | <h2>Failures</h2>
|
---|
383 | </xsl:when>
|
---|
384 | <xsl:when test="$type = 'errors'">
|
---|
385 | <h2>Errors</h2>
|
---|
386 | </xsl:when>
|
---|
387 | <xsl:when test="$type = 'skipped'">
|
---|
388 | <h2>Skipped</h2>
|
---|
389 | </xsl:when>
|
---|
390 | <xsl:otherwise>
|
---|
391 | <h2>Tests</h2>
|
---|
392 | </xsl:otherwise>
|
---|
393 | </xsl:choose>
|
---|
394 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
395 | <xsl:call-template name="testcase.test.header"/>
|
---|
396 | <!--
|
---|
397 | test can even not be started at all (failure to load the class)
|
---|
398 | so report the error directly
|
---|
399 | -->
|
---|
400 | <xsl:if test="./error">
|
---|
401 | <tr class="Error">
|
---|
402 | <td colspan="4"><xsl:apply-templates select="./error"/></td>
|
---|
403 | </tr>
|
---|
404 | </xsl:if>
|
---|
405 | <xsl:choose>
|
---|
406 | <xsl:when test="$type = 'fails'">
|
---|
407 | <xsl:apply-templates select="./testcase[failure]" mode="print.test"/>
|
---|
408 | </xsl:when>
|
---|
409 | <xsl:when test="$type = 'errors'">
|
---|
410 | <xsl:apply-templates select="./testcase[error]" mode="print.test"/>
|
---|
411 | </xsl:when>
|
---|
412 | <xsl:when test="$type = 'skipped'">
|
---|
413 | <xsl:apply-templates select="./testcase[skipped]" mode="print.test"/>
|
---|
414 | </xsl:when>
|
---|
415 | <xsl:otherwise>
|
---|
416 | <xsl:apply-templates select="./testcase" mode="print.test"/>
|
---|
417 | </xsl:otherwise>
|
---|
418 | </xsl:choose>
|
---|
419 | </table>
|
---|
420 | <div class="Properties">
|
---|
421 | <a>
|
---|
422 | <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
|
---|
423 | Properties »
|
---|
424 | </a>
|
---|
425 | </div>
|
---|
426 | <xsl:if test="string-length(./system-out)!=0">
|
---|
427 | <div class="Properties">
|
---|
428 | <a>
|
---|
429 | <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-out.html</xsl:attribute>
|
---|
430 | System.out »
|
---|
431 | </a>
|
---|
432 | </div>
|
---|
433 | </xsl:if>
|
---|
434 | <xsl:if test="string-length(./system-err)!=0">
|
---|
435 | <div class="Properties">
|
---|
436 | <a>
|
---|
437 | <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-err.html</xsl:attribute>
|
---|
438 | System.err »
|
---|
439 | </a>
|
---|
440 | </div>
|
---|
441 | </xsl:if>
|
---|
442 | </body>
|
---|
443 | </html>
|
---|
444 | </xsl:template>
|
---|
445 |
|
---|
446 | <!--
|
---|
447 | Write properties into a JavaScript data structure.
|
---|
448 | This is based on the original idea by Erik Hatcher ([email protected])
|
---|
449 | -->
|
---|
450 | <xsl:template match="properties">
|
---|
451 | cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array();
|
---|
452 | <xsl:for-each select="property">
|
---|
453 | <xsl:sort select="@name"/>
|
---|
454 | cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
|
---|
455 | </xsl:for-each>
|
---|
456 | </xsl:template>
|
---|
457 |
|
---|
458 |
|
---|
459 | <!-- ======================================================================
|
---|
460 | This page is created for every package.
|
---|
461 | It prints the name of all classes that belongs to this package.
|
---|
462 | @param name the package name to print classes.
|
---|
463 | ====================================================================== -->
|
---|
464 | <!-- list of classes in a package -->
|
---|
465 | <xsl:template name="classes.list">
|
---|
466 | <xsl:param name="name"/>
|
---|
467 | <html>
|
---|
468 | <head>
|
---|
469 | <title>Unit Test Classes: <xsl:value-of select="$name"/></title>
|
---|
470 | <xsl:call-template name="create.stylesheet.link">
|
---|
471 | <xsl:with-param name="package.name" select="$name"/>
|
---|
472 | </xsl:call-template>
|
---|
473 | </head>
|
---|
474 | <body>
|
---|
475 | <table width="100%">
|
---|
476 | <tr>
|
---|
477 | <td nowrap="nowrap">
|
---|
478 | <h2><a href="package-summary.html" target="classFrame">
|
---|
479 | <xsl:value-of select="$name"/>
|
---|
480 | <xsl:if test="$name = ''"><none></xsl:if>
|
---|
481 | </a></h2>
|
---|
482 | </td>
|
---|
483 | </tr>
|
---|
484 | </table>
|
---|
485 |
|
---|
486 | <h2>Classes</h2>
|
---|
487 | <table width="100%">
|
---|
488 | <xsl:for-each select="/testsuites/testsuite[./@package = $name]">
|
---|
489 | <xsl:sort select="@name"/>
|
---|
490 | <tr>
|
---|
491 | <td nowrap="nowrap">
|
---|
492 | <a href="{@id}_{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
|
---|
493 | </td>
|
---|
494 | </tr>
|
---|
495 | </xsl:for-each>
|
---|
496 | </table>
|
---|
497 | </body>
|
---|
498 | </html>
|
---|
499 | </xsl:template>
|
---|
500 |
|
---|
501 |
|
---|
502 | <!--
|
---|
503 | Creates an all-classes.html file that contains a link to all package-summary.html
|
---|
504 | on each class.
|
---|
505 | -->
|
---|
506 | <xsl:template match="testsuites" mode="all.classes">
|
---|
507 | <html>
|
---|
508 | <head>
|
---|
509 | <title>All Unit Test Classes</title>
|
---|
510 | <xsl:call-template name="create.stylesheet.link">
|
---|
511 | <xsl:with-param name="package.name"/>
|
---|
512 | </xsl:call-template>
|
---|
513 | </head>
|
---|
514 | <body>
|
---|
515 | <h2>Classes</h2>
|
---|
516 | <table width="100%">
|
---|
517 | <xsl:apply-templates select="testsuite" mode="all.classes">
|
---|
518 | <xsl:sort select="@name"/>
|
---|
519 | </xsl:apply-templates>
|
---|
520 | </table>
|
---|
521 | </body>
|
---|
522 | </html>
|
---|
523 | </xsl:template>
|
---|
524 |
|
---|
525 | <xsl:template match="testsuite" mode="all.classes">
|
---|
526 | <xsl:variable name="package.name" select="@package"/>
|
---|
527 | <tr>
|
---|
528 | <td nowrap="nowrap">
|
---|
529 | <a target="classFrame">
|
---|
530 | <xsl:attribute name="href">
|
---|
531 | <xsl:if test="not($package.name='')">
|
---|
532 | <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
|
---|
533 | </xsl:if><xsl:value-of select="@id"/>_<xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
|
---|
534 | </xsl:attribute>
|
---|
535 | <xsl:value-of select="@name"/>
|
---|
536 | </a>
|
---|
537 | </td>
|
---|
538 | </tr>
|
---|
539 | </xsl:template>
|
---|
540 |
|
---|
541 |
|
---|
542 | <!--
|
---|
543 | Creates an html file that contains a link to all package-summary.html files on
|
---|
544 | each package existing on testsuites.
|
---|
545 | @bug there will be a problem here, I don't know yet how to handle unnamed package :(
|
---|
546 | -->
|
---|
547 | <xsl:template match="testsuites" mode="all.packages">
|
---|
548 | <html>
|
---|
549 | <head>
|
---|
550 | <title>All Unit Test Packages</title>
|
---|
551 | <xsl:call-template name="create.stylesheet.link">
|
---|
552 | <xsl:with-param name="package.name"/>
|
---|
553 | </xsl:call-template>
|
---|
554 | </head>
|
---|
555 | <body>
|
---|
556 | <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
|
---|
557 | <h2>Packages</h2>
|
---|
558 | <table width="100%">
|
---|
559 | <xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
|
---|
560 | <xsl:sort select="@package"/>
|
---|
561 | </xsl:apply-templates>
|
---|
562 | </table>
|
---|
563 | </body>
|
---|
564 | </html>
|
---|
565 | </xsl:template>
|
---|
566 |
|
---|
567 | <xsl:template match="testsuite" mode="all.packages">
|
---|
568 | <tr>
|
---|
569 | <td nowrap="nowrap">
|
---|
570 | <a href="./{translate(@package,'.','/')}/package-summary.html" target="classFrame">
|
---|
571 | <xsl:value-of select="@package"/>
|
---|
572 | <xsl:if test="@package = ''"><none></xsl:if>
|
---|
573 | </a>
|
---|
574 | </td>
|
---|
575 | </tr>
|
---|
576 | </xsl:template>
|
---|
577 |
|
---|
578 |
|
---|
579 | <xsl:template match="testsuites" mode="overview.packages">
|
---|
580 | <html>
|
---|
581 | <head>
|
---|
582 | <title>Unit Test Results: Summary</title>
|
---|
583 | <xsl:call-template name="create.stylesheet.link">
|
---|
584 | <xsl:with-param name="package.name"/>
|
---|
585 | </xsl:call-template>
|
---|
586 | </head>
|
---|
587 | <body>
|
---|
588 | <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
|
---|
589 | <xsl:call-template name="pageHeader"/>
|
---|
590 | <h2>Summary</h2>
|
---|
591 | <xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
|
---|
592 | <xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
|
---|
593 | <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
|
---|
594 | <xsl:variable name="skippedCount" select="sum(testsuite/@skipped)" />
|
---|
595 | <xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
|
---|
596 | <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
|
---|
597 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
598 | <tr valign="top">
|
---|
599 | <th>Tests</th>
|
---|
600 | <th>Failures</th>
|
---|
601 | <th>Errors</th>
|
---|
602 | <th>Skipped</th>
|
---|
603 | <th>Success rate</th>
|
---|
604 | <th>Time</th>
|
---|
605 | </tr>
|
---|
606 | <tr valign="top">
|
---|
607 | <xsl:attribute name="class">
|
---|
608 | <xsl:choose>
|
---|
609 | <xsl:when test="$errorCount > 0">Error</xsl:when>
|
---|
610 | <xsl:when test="$failureCount > 0">Failure</xsl:when>
|
---|
611 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
612 | </xsl:choose>
|
---|
613 | </xsl:attribute>
|
---|
614 | <td><a title="Display all tests" href="all-tests.html"><xsl:value-of select="$testCount"/></a></td>
|
---|
615 | <td><a title="Display all failures" href="alltests-fails.html"><xsl:value-of select="$failureCount"/></a></td>
|
---|
616 | <td><a title="Display all errors" href="alltests-errors.html"><xsl:value-of select="$errorCount"/></a></td>
|
---|
617 | <td><a title="Display all skipped test" href="alltests-skipped.html"><xsl:value-of select="$skippedCount" /></a></td>
|
---|
618 | <td>
|
---|
619 | <xsl:call-template name="display-percent">
|
---|
620 | <xsl:with-param name="value" select="$successRate"/>
|
---|
621 | </xsl:call-template>
|
---|
622 | </td>
|
---|
623 | <td>
|
---|
624 | <xsl:call-template name="display-time">
|
---|
625 | <xsl:with-param name="value" select="$timeCount"/>
|
---|
626 | </xsl:call-template>
|
---|
627 | </td>
|
---|
628 | </tr>
|
---|
629 | </table>
|
---|
630 | <table border="0" width="95%">
|
---|
631 | <tr>
|
---|
632 | <td style="text-align: justify;">
|
---|
633 | Note: <em>failures</em> are anticipated and checked for with assertions while <em>errors</em> are unanticipated.
|
---|
634 | </td>
|
---|
635 | </tr>
|
---|
636 | </table>
|
---|
637 |
|
---|
638 | <h2>Packages</h2>
|
---|
639 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
640 | <xsl:call-template name="testsuite.test.header"/>
|
---|
641 | <xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
|
---|
642 | <xsl:sort select="@package" order="ascending"/>
|
---|
643 | <!-- get the node set containing all testsuites that have the same package -->
|
---|
644 | <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
|
---|
645 | <tr valign="top">
|
---|
646 | <!-- display a failure if there is any failure/error in the package -->
|
---|
647 | <xsl:attribute name="class">
|
---|
648 | <xsl:choose>
|
---|
649 | <xsl:when test="sum($insamepackage/@errors) > 0">Error</xsl:when>
|
---|
650 | <xsl:when test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
|
---|
651 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
652 | </xsl:choose>
|
---|
653 | </xsl:attribute>
|
---|
654 | <td><a href="./{translate(@package,'.','/')}/package-summary.html">
|
---|
655 | <xsl:value-of select="@package"/>
|
---|
656 | <xsl:if test="@package = ''"><none></xsl:if>
|
---|
657 | </a></td>
|
---|
658 | <td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
|
---|
659 | <td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
|
---|
660 | <td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
|
---|
661 | <td><xsl:value-of select="sum($insamepackage/@skipped)" /></td>
|
---|
662 | <td>
|
---|
663 | <xsl:call-template name="display-time">
|
---|
664 | <xsl:with-param name="value" select="sum($insamepackage/@time)"/>
|
---|
665 | </xsl:call-template>
|
---|
666 | </td>
|
---|
667 | <td><xsl:value-of select="$insamepackage/@timestamp"/></td>
|
---|
668 | <td><xsl:value-of select="$insamepackage/@hostname"/></td>
|
---|
669 | </tr>
|
---|
670 | </xsl:for-each>
|
---|
671 | </table>
|
---|
672 | </body>
|
---|
673 | </html>
|
---|
674 | </xsl:template>
|
---|
675 |
|
---|
676 |
|
---|
677 | <xsl:template name="package.summary">
|
---|
678 | <xsl:param name="name"/>
|
---|
679 | <html>
|
---|
680 | <head>
|
---|
681 | <xsl:call-template name="create.stylesheet.link">
|
---|
682 | <xsl:with-param name="package.name" select="$name"/>
|
---|
683 | </xsl:call-template>
|
---|
684 | </head>
|
---|
685 | <body>
|
---|
686 | <xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
|
---|
687 | <xsl:call-template name="pageHeader"/>
|
---|
688 | <h3>Package <xsl:value-of select="$name"/></h3>
|
---|
689 |
|
---|
690 | <!--table border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
691 | <xsl:call-template name="class.metrics.header"/>
|
---|
692 | <xsl:apply-templates select="." mode="print.metrics"/>
|
---|
693 | </table-->
|
---|
694 |
|
---|
695 | <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
|
---|
696 | <xsl:if test="count($insamepackage) > 0">
|
---|
697 | <h2>Classes</h2>
|
---|
698 | <p>
|
---|
699 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
700 | <xsl:call-template name="testsuite.test.header"/>
|
---|
701 | <xsl:apply-templates select="$insamepackage" mode="print.test">
|
---|
702 | <xsl:sort select="@name"/>
|
---|
703 | </xsl:apply-templates>
|
---|
704 | </table>
|
---|
705 | </p>
|
---|
706 | </xsl:if>
|
---|
707 | </body>
|
---|
708 | </html>
|
---|
709 | </xsl:template>
|
---|
710 |
|
---|
711 |
|
---|
712 | <!--
|
---|
713 | transform string like a.b.c to ../../../
|
---|
714 | @param path the path to transform into a descending directory path
|
---|
715 | -->
|
---|
716 | <xsl:template name="path">
|
---|
717 | <xsl:param name="path"/>
|
---|
718 | <xsl:if test="contains($path,'.')">
|
---|
719 | <xsl:text>../</xsl:text>
|
---|
720 | <xsl:call-template name="path">
|
---|
721 | <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param>
|
---|
722 | </xsl:call-template>
|
---|
723 | </xsl:if>
|
---|
724 | <xsl:if test="not(contains($path,'.')) and not($path = '')">
|
---|
725 | <xsl:text>../</xsl:text>
|
---|
726 | </xsl:if>
|
---|
727 | </xsl:template>
|
---|
728 |
|
---|
729 |
|
---|
730 | <!-- create the link to the stylesheet based on the package name -->
|
---|
731 | <xsl:template name="create.stylesheet.link">
|
---|
732 | <xsl:param name="package.name"/>
|
---|
733 | <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>
|
---|
734 | </xsl:template>
|
---|
735 |
|
---|
736 |
|
---|
737 | <!-- Page HEADER -->
|
---|
738 | <xsl:template name="pageHeader">
|
---|
739 | <h1><xsl:value-of select="$TITLE"/></h1>
|
---|
740 | <table width="100%">
|
---|
741 | <tr>
|
---|
742 | <td align="left"></td>
|
---|
743 | <td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://ant.apache.org/">Ant</a>.</td>
|
---|
744 | </tr>
|
---|
745 | </table>
|
---|
746 | <hr size="1"/>
|
---|
747 | </xsl:template>
|
---|
748 |
|
---|
749 | <!-- class header -->
|
---|
750 | <xsl:template name="testsuite.test.header">
|
---|
751 | <tr valign="top">
|
---|
752 | <th width="80%">Name</th>
|
---|
753 | <th>Tests</th>
|
---|
754 | <th>Errors</th>
|
---|
755 | <th>Failures</th>
|
---|
756 | <th>Skipped</th>
|
---|
757 | <th nowrap="nowrap">Time(s)</th>
|
---|
758 | <th nowrap="nowrap">Time Stamp</th>
|
---|
759 | <th>Host</th>
|
---|
760 | </tr>
|
---|
761 | </xsl:template>
|
---|
762 |
|
---|
763 | <!-- method header -->
|
---|
764 | <xsl:template name="testcase.test.header">
|
---|
765 | <xsl:param name="show.class" select="''"/>
|
---|
766 | <tr valign="top">
|
---|
767 | <xsl:if test="boolean($show.class)">
|
---|
768 | <th>Class</th>
|
---|
769 | </xsl:if>
|
---|
770 | <th>Name</th>
|
---|
771 | <th>Status</th>
|
---|
772 | <th width="80%">Type</th>
|
---|
773 | <th nowrap="nowrap">Time(s)</th>
|
---|
774 | </tr>
|
---|
775 | </xsl:template>
|
---|
776 |
|
---|
777 |
|
---|
778 | <!-- class information -->
|
---|
779 | <xsl:template match="testsuite" mode="print.test">
|
---|
780 | <tr valign="top">
|
---|
781 | <xsl:attribute name="class">
|
---|
782 | <xsl:choose>
|
---|
783 | <xsl:when test="@errors[.> 0]">Error</xsl:when>
|
---|
784 | <xsl:when test="@failures[.> 0]">Failure</xsl:when>
|
---|
785 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
786 | </xsl:choose>
|
---|
787 | </xsl:attribute>
|
---|
788 | <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:value-of select="@name"/></a></td>
|
---|
789 | <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:apply-templates select="@tests"/></a></td>
|
---|
790 | <td>
|
---|
791 | <xsl:choose>
|
---|
792 | <xsl:when test="@errors != 0">
|
---|
793 | <a title="Display only errors" href="{@id}_{@name}-errors.html"><xsl:apply-templates select="@errors"/></a>
|
---|
794 | </xsl:when>
|
---|
795 | <xsl:otherwise>
|
---|
796 | <xsl:apply-templates select="@errors"/>
|
---|
797 | </xsl:otherwise>
|
---|
798 | </xsl:choose>
|
---|
799 | </td>
|
---|
800 | <td>
|
---|
801 | <xsl:choose>
|
---|
802 | <xsl:when test="@failures != 0">
|
---|
803 | <a title="Display only failures" href="{@id}_{@name}-fails.html"><xsl:apply-templates select="@failures"/></a>
|
---|
804 | </xsl:when>
|
---|
805 | <xsl:otherwise>
|
---|
806 | <xsl:apply-templates select="@failures"/>
|
---|
807 | </xsl:otherwise>
|
---|
808 | </xsl:choose>
|
---|
809 | </td>
|
---|
810 | <td>
|
---|
811 | <xsl:choose>
|
---|
812 | <xsl:when test="@skipped != 0">
|
---|
813 | <a title="Display only skipped tests" href="{@id}_{@name}-skipped.html"><xsl:apply-templates select="@skipped"/></a>
|
---|
814 | </xsl:when>
|
---|
815 | <xsl:otherwise>
|
---|
816 | <xsl:apply-templates select="@skipped"/>
|
---|
817 | </xsl:otherwise>
|
---|
818 | </xsl:choose>
|
---|
819 | </td>
|
---|
820 | <td><xsl:call-template name="display-time">
|
---|
821 | <xsl:with-param name="value" select="@time"/>
|
---|
822 | </xsl:call-template>
|
---|
823 | </td>
|
---|
824 | <td><xsl:apply-templates select="@timestamp"/></td>
|
---|
825 | <td><xsl:apply-templates select="@hostname"/></td>
|
---|
826 | </tr>
|
---|
827 | </xsl:template>
|
---|
828 |
|
---|
829 | <xsl:template match="testcase" mode="print.test">
|
---|
830 | <xsl:param name="show.class" select="''"/>
|
---|
831 | <tr valign="top">
|
---|
832 | <xsl:attribute name="class">
|
---|
833 | <xsl:choose>
|
---|
834 | <xsl:when test="error">Error</xsl:when>
|
---|
835 | <xsl:when test="failure">Failure</xsl:when>
|
---|
836 | <xsl:otherwise>TableRowColor</xsl:otherwise>
|
---|
837 | </xsl:choose>
|
---|
838 | </xsl:attribute>
|
---|
839 | <xsl:variable name="class.href">
|
---|
840 | <xsl:value-of select="concat(translate(../@package,'.','/'), '/', ../@id, '_', ../@name, '.html')"/>
|
---|
841 | </xsl:variable>
|
---|
842 | <xsl:if test="boolean($show.class)">
|
---|
843 | <td><a href="{$class.href}"><xsl:value-of select="../@name"/></a></td>
|
---|
844 | </xsl:if>
|
---|
845 | <td>
|
---|
846 | <a name="{@name}"/>
|
---|
847 | <xsl:choose>
|
---|
848 | <xsl:when test="boolean($show.class)">
|
---|
849 | <a href="{concat($class.href, '#', @name)}"><xsl:value-of select="@name"/></a>
|
---|
850 | </xsl:when>
|
---|
851 | <xsl:otherwise>
|
---|
852 | <xsl:value-of select="@name"/>
|
---|
853 | </xsl:otherwise>
|
---|
854 | </xsl:choose>
|
---|
855 | </td>
|
---|
856 | <xsl:choose>
|
---|
857 | <xsl:when test="failure">
|
---|
858 | <td>Failure</td>
|
---|
859 | <td><xsl:apply-templates select="failure"/></td>
|
---|
860 | </xsl:when>
|
---|
861 | <xsl:when test="error">
|
---|
862 | <td>Error</td>
|
---|
863 | <td><xsl:apply-templates select="error"/></td>
|
---|
864 | </xsl:when>
|
---|
865 | <xsl:when test="skipped">
|
---|
866 | <td>Skipped</td>
|
---|
867 | <td><xsl:apply-templates select="skipped"/></td>
|
---|
868 | </xsl:when>
|
---|
869 | <xsl:otherwise>
|
---|
870 | <td>Success</td>
|
---|
871 | <td></td>
|
---|
872 | </xsl:otherwise>
|
---|
873 | </xsl:choose>
|
---|
874 | <td>
|
---|
875 | <xsl:call-template name="display-time">
|
---|
876 | <xsl:with-param name="value" select="@time"/>
|
---|
877 | </xsl:call-template>
|
---|
878 | </td>
|
---|
879 | </tr>
|
---|
880 | </xsl:template>
|
---|
881 |
|
---|
882 |
|
---|
883 | <!-- Note : the below template skipped, error and failure are the same style
|
---|
884 | so just call the same style store in the toolkit template -->
|
---|
885 | <xsl:template match="failure">
|
---|
886 | <xsl:call-template name="display-failures"/>
|
---|
887 | </xsl:template>
|
---|
888 |
|
---|
889 | <xsl:template match="error">
|
---|
890 | <xsl:call-template name="display-failures"/>
|
---|
891 | </xsl:template>
|
---|
892 |
|
---|
893 | <xsl:template match="skipped">
|
---|
894 | <xsl:call-template name="display-failures"/>
|
---|
895 | </xsl:template>
|
---|
896 |
|
---|
897 | <!-- Style for the error and failure in the testcase template -->
|
---|
898 | <xsl:template name="display-failures">
|
---|
899 | <xsl:choose>
|
---|
900 | <xsl:when test="not(@message)">N/A</xsl:when>
|
---|
901 | <xsl:otherwise>
|
---|
902 | <xsl:value-of select="@message"/>
|
---|
903 | </xsl:otherwise>
|
---|
904 | </xsl:choose>
|
---|
905 | <!-- display the stacktrace -->
|
---|
906 | <br/><br/>
|
---|
907 | <code>
|
---|
908 | <xsl:call-template name="br-replace">
|
---|
909 | <xsl:with-param name="word" select="."/>
|
---|
910 | </xsl:call-template>
|
---|
911 | </code>
|
---|
912 | <!-- the latter is better but might be problematic for non-21" monitors... -->
|
---|
913 | <!--pre><xsl:value-of select="."/></pre-->
|
---|
914 | </xsl:template>
|
---|
915 |
|
---|
916 | <xsl:template name="JS-escape">
|
---|
917 | <xsl:param name="string"/>
|
---|
918 | <xsl:param name="tmp1" select="string:replaceAll(string:new(string($string)),'\\','\\\\')"/>
|
---|
919 | <xsl:param name="tmp2" select="string:replaceAll(string:new(string($tmp1)),"'","\\'")"/>
|
---|
920 | <xsl:param name="tmp3" select="string:replaceAll(string:new(string($tmp2))," ",'\\n')"/>
|
---|
921 | <xsl:param name="tmp4" select="string:replaceAll(string:new(string($tmp3))," ",'\\r')"/>
|
---|
922 | <xsl:value-of select="$tmp4"/>
|
---|
923 | </xsl:template>
|
---|
924 |
|
---|
925 |
|
---|
926 | <!--
|
---|
927 | template that will convert a carriage return into a br tag
|
---|
928 | @param word the text from which to convert CR to BR tag
|
---|
929 | -->
|
---|
930 | <xsl:template name="br-replace">
|
---|
931 | <xsl:param name="word"/>
|
---|
932 | <xsl:choose>
|
---|
933 | <xsl:when test="contains($word, '
')">
|
---|
934 | <xsl:value-of select="substring-before($word, '
')"/>
|
---|
935 | <br/>
|
---|
936 | <xsl:call-template name="br-replace">
|
---|
937 | <xsl:with-param name="word" select="substring-after($word, '
')"/>
|
---|
938 | </xsl:call-template>
|
---|
939 | </xsl:when>
|
---|
940 | <xsl:otherwise>
|
---|
941 | <xsl:value-of select="$word"/>
|
---|
942 | </xsl:otherwise>
|
---|
943 | </xsl:choose>
|
---|
944 | </xsl:template>
|
---|
945 |
|
---|
946 | <xsl:template name="display-time">
|
---|
947 | <xsl:param name="value"/>
|
---|
948 | <xsl:value-of select="format-number($value,'0.000')"/>
|
---|
949 | </xsl:template>
|
---|
950 |
|
---|
951 | <xsl:template name="display-percent">
|
---|
952 | <xsl:param name="value"/>
|
---|
953 | <xsl:value-of select="format-number($value,'0.00%')"/>
|
---|
954 | </xsl:template>
|
---|
955 | </xsl:stylesheet>
|
---|