2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY space
" ">
4 <!ENTITY nbsp
" ">
5 <!ENTITY bullet
"•">]
>
8 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" version=
"1.0"
9 xmlns:
xslt=
"http://xml.apache.org/xslt"
11 <xsl:output method=
"html"/>
13 <!-- collects all task nodes with parent target into the variable $tasklist -->
14 <xsl:variable name=
"tasklist" select=
"//task"/>
16 <!-- collects all task nodes from $tasklist with attribute name="Javac" etc. -->
17 <xsl:variable name=
"javac.tasklist" select=
"$tasklist[@name='javac']"/>
18 <xsl:variable name=
"ejbjar.tasklist" select=
"$tasklist[@name='ejbjar']"/>
19 <xsl:variable name=
"jar.tasklist" select=
"$tasklist[@name='jar']"/>
20 <xsl:variable name=
"war.tasklist" select=
"$tasklist[@name='war']"/>
22 <!-- count elements in sublists -->
23 <xsl:variable name=
"dist.count" select=
"count($jar.tasklist) + count($war.tasklist)"/>
25 <!-- collect all testsuite nodes in build, regardless of depth -->
26 <xsl:variable name=
"testsuite.list" select=
"//testsuites/testsuite"/>
27 <!-- count error nodes directly under testsuite -->
28 <xsl:variable name=
"testsuite.error.count" select=
"count($testsuite.list/error)"/>
30 <xsl:variable name=
"testcase.list" select=
"$testsuite.list/testcase"/>
31 <xsl:variable name=
"testcase.error.list" select=
"$testcase.list/error"/>
32 <xsl:variable name=
"testcase.failure.list" select=
"$testcase.list/failure"/>
33 <xsl:variable name=
"totalErrorsAndFailures" select=
"count($testcase.error.list) + count($testcase.failure.list)"/>
35 <!-- 1: /build/modifications, 2: /cruisecontrol/modifications -->
36 <xsl:variable name=
"modification.list" select=
"//modifications/modification"/>
37 <!-- collects all the modification sets -->
38 <xsl:key name=
"modificationSet" match=
"//modifications/modification" use=
"concat(user,':',comment)"/>
40 <!-- long template for the whole page, this ensures sequence -->
41 <xsl:template match=
"/">
45 <xsl:when test=
"//build/@error"> <!-- build tag contains attribute error -->
50 <xsl:text>BUILD COMPLETE -
&space;</xsl:text>
51 <!-- support CruiseControl 1.0 and 2.0 -->
52 <xsl:value-of select=
"build/label | //info/property[@name='label']/@value"/>
59 <th>Date of build
</th>
61 <!-- support CruiseControl 1.0 and 2.0 -->
62 <xsl:value-of select=
"build/today | //info/property[@name='builddate']/@value"/>
66 <th>Time to build
</th>
68 <xsl:value-of select=
"//build/@time"/>
74 <xsl:value-of select=
"//modifications/modification/date"/>
78 <th>Last log entry
</th>
80 <xsl:value-of select=
"//modifications/modification/comment"/>
85 <xsl:if test=
"//build/@error">
86 <h2>Ant Error Message
</h2>
88 <xsl:value-of select=
"//build/@error"/>
91 <xsl:value-of select=
"//stacktrace"/>
95 <!-- Compilation Messages -->
97 <xsl:variable name=
"javac.warn.messages" select=
"$javac.tasklist/message[@priority='warn']"/>
98 <xsl:variable name=
"ejbjar.warn.messages" select=
"$ejbjar.tasklist/message[@priority='warn']"/>
99 <xsl:variable name=
"total.errorMessage.count"
100 select=
"count($javac.warn.messages) + count($ejbjar.warn.messages)"/>
102 <!-- NOTE: total.errorMessage.count is actually the number of lines of error
103 messages. This accurately represents the number of errors ONLY if the Ant property
104 build.compiler.emacs is set to "true" -->
105 <xsl:if test=
"$total.errorMessage.count > 0">
107 <xsl:text>Error-/Warning- Lines:
&space;</xsl:text>
108 <xsl:value-of select=
"$total.errorMessage.count"/>
112 <xsl:apply-templates select=
"$javac.warn.messages"/>
117 <xsl:variable name=
"unit.passed" select=
"count($testcase.list)-$totalErrorsAndFailures"/>
121 <xsl:text>Test cases:
&space;</xsl:text>
123 <xsl:value-of select=
"count($testcase.list)"/>
125 <xsl:text>, passed:
&space;</xsl:text>
127 <xsl:value-of select=
"$unit.passed"/>
129 <xsl:text>, failures:
&space;</xsl:text>
131 <xsl:value-of select=
"count($testcase.failure.list)"/>
133 <xsl:text>, errors:
&space;</xsl:text>
135 <xsl:value-of select=
"count($testcase.error.list)"/>
137 <xsl:text>.
</xsl:text>
140 <xsl:call-template name=
"colorBar">
141 <xsl:with-param name=
"success.count" select=
"$unit.passed"/>
142 <xsl:with-param name=
"failed.count" select=
"$totalErrorsAndFailures"/>
143 <xsl:with-param name=
"total.count" select=
"count($testcase.list)"/>
144 <xsl:with-param name=
"tableID">utests
</xsl:with-param>
147 <xsl:if test=
"count($testcase.error.list) > 0">
150 <xsl:apply-templates select=
"$testcase.error.list"/>
154 <xsl:if test=
"count($testcase.failure.list) > 0">
157 <xsl:apply-templates select=
"$testcase.failure.list"/>
161 <xsl:if test=
"$totalErrorsAndFailures > 0">
163 <xsl:text>Unit Test Error Details:
&space;(
</xsl:text>
164 <xsl:value-of select=
"$totalErrorsAndFailures"/>
165 <xsl:text>)
</xsl:text>
167 <xsl:apply-templates select=
"//testsuite/testcase[.//error]"/>
168 <xsl:apply-templates select=
"//testsuite/testcase[.//failure]"/>
171 <!-- Functional Tests -->
173 <!-- functional testing vars -->
174 <xsl:variable name=
"cases" select=
"//summary/testresult"/>
175 <xsl:variable name=
"steps" select=
"//summary/testresult/results/step"/>
176 <xsl:variable name=
"passed" select=
"$cases[@successful='yes']"/>
177 <xsl:variable name=
"failed" select=
"$cases[@successful='no']"/>
179 <h2>Functional Tests
</h2>
181 <xsl:text>Szenarios:
&space;</xsl:text>
183 <xsl:value-of select=
"count($cases)"/>
185 <xsl:text>, passed:
&space;</xsl:text>
187 <xsl:value-of select=
"count($passed)"/>
189 <xsl:text>, failed:
&space;</xsl:text>
191 <xsl:value-of select=
"count($failed)"/>
193 <xsl:text>, including
&space;</xsl:text>
195 <xsl:value-of select=
"count($steps)"/>
197 <xsl:text>&space;single steps.
</xsl:text>
200 <xsl:call-template name=
"colorBar">
201 <xsl:with-param name=
"success.count" select=
"count($passed)"/>
202 <xsl:with-param name=
"failed.count" select=
"count($failed)"/>
203 <xsl:with-param name=
"total.count" select=
"count($cases)"/>
204 <xsl:with-param name=
"tableID">ftests
</xsl:with-param>
207 <h2>Modifications
</h2>
209 <xsl:value-of select=
"count($modification.list)"/>
210 <xsl:text>&space;modifications since last build.
</xsl:text>
213 <xsl:for-each select=
"$modification.list[count(.|key('modificationSet',concat(user,':',comment))[1])=1]">
215 <xsl:value-of select=
"user"/>
216 <xsl:text>:
&space;</xsl:text>
217 <xsl:value-of select=
"comment"/>
218 <xsl:text>&space;(
</xsl:text>
219 <xsl:value-of select=
"date"/>
220 <xsl:text>)
</xsl:text>
223 <xsl:apply-templates select=
"key('modificationSet',concat(user,':',comment))"/>
228 <xsl:if test=
"$dist.count > 0">
231 <xsl:value-of select=
"$dist.count"/>
232 <xsl:text>&space;files deployed by this build.
</xsl:text>
236 <xsl:apply-templates select=
"$jar.tasklist | $war.tasklist"/>
242 <xsl:template name=
"colorBar">
243 <xsl:param name=
"success.count"/>
244 <xsl:param name=
"failed.count"/>
245 <xsl:param name=
"total.count"/>
246 <xsl:param name=
"tableID"/>
248 <table bgcolor=
"white" cellspacing=
"0" cellpadding=
"0">
249 <xsl:attribute name=
"id">
250 <xsl:value-of select=
"$tableID"/>
253 <xsl:if test=
"$success.count > 0">
255 <xsl:attribute name=
"width">
256 <xsl:value-of select=
"concat($success.count * 100 div $total.count, '%')"/>
262 <xsl:if test=
"$failed.count > 0">
263 <td bgcolor=
"#FFFFA0">
264 <xsl:attribute name=
"width">
265 <xsl:value-of select=
"concat($failed.count * 100 div $total.count, '%')"/>
271 <xsl:if test=
"($total.count = 0) or ($total.count > ($success.count + $failed.count))">
279 <!-- UnitTest Errors/Failures -->
280 <xsl:template match=
"error|failure">
282 <xsl:call-template name=
"colorOddEvenRow"/>
283 <xsl:value-of select=
"../@name"/>
287 <!-- UnitTest Errors And Failures Detail Template -->
288 <xsl:template match=
"//testsuite/testcase">
290 <xsl:text>Test:
&space;</xsl:text>
291 <xsl:value-of select=
"@name"/>
295 <xsl:text>Type:
</xsl:text>
296 <xsl:value-of select=
"node()/@type"/>
299 <xsl:text>Message:
</xsl:text>
300 <xsl:value-of select=
"node()/@message"/>
304 <xsl:value-of select=
"node()"/>
308 <!-- Compilation Error Details -->
309 <xsl:template match=
"message[@priority='warn']">
310 <xsl:value-of select=
"text()"/>
313 <!-- Test Execution Stacktrace -->
314 <xsl:template match=
"stacktrace">
316 <xsl:value-of select=
"text()"/>
320 <!-- Modifications template -->
321 <xsl:template match=
"modification[file/filename]">
324 <xsl:call-template name=
"colorOddEvenRow"/>
325 <xsl:call-template name=
"modificationType">
326 <xsl:with-param name=
"type" select=
"file/@action"/>
329 <xsl:value-of select=
"file/project"/>
330 <xsl:if test=
"string-length(normalize-space(file/project))">
331 <xsl:text>/
</xsl:text>
333 <xsl:value-of select=
"file/filename"/>
337 <xsl:template match=
"modification">
340 <xsl:call-template name=
"colorOddEvenRow"/>
341 <xsl:call-template name=
"modificationType">
342 <xsl:with-param name=
"type" select=
"@type"/>
345 <xsl:value-of select=
"filename"/>
349 <xsl:template name=
"modificationType">
350 <xsl:param name=
"type"/>
352 <span class=
"modifificationType">
354 <xsl:when test=
"$type='modified'">></xsl:when>
355 <xsl:when test=
"$type='added'">+
</xsl:when>
356 <xsl:when test=
"$type='deleted'">-
</xsl:when>
357 <xsl:otherwise><xsl:value-of select=
"$type"/></xsl:otherwise>
364 <!-- jar and war template -->
365 <xsl:template match=
"task[translate(string(@name),'jJwW','')='ar']">
367 <xsl:call-template name=
"colorOddEvenRow"/>
368 <xsl:value-of select=
"message"/>
372 <xsl:template name=
"colorOddEvenRow">
373 <xsl:attribute name=
"class">
375 <xsl:when test=
"position() mod 2 = 0">evenrow
</xsl:when>
376 <xsl:otherwise>oddrow
</xsl:otherwise>