log.xsl 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="html" indent="yes" encoding="US-ASCII"/>
  4. <!--
  5. Licensed to the Apache Software Foundation (ASF) under one or more
  6. contributor license agreements. See the NOTICE file distributed with
  7. this work for additional information regarding copyright ownership.
  8. The ASF licenses this file to You under the Apache License, Version 2.0
  9. (the "License"); you may not use this file except in compliance with
  10. the License. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. -->
  18. <!--
  19. The purpose have this XSL is to provide a nice way to look at the output
  20. from the Ant XmlLogger (ie: ant -listener org.apache.tools.ant.XmlLogger )
  21. @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
  22. -->
  23. <xsl:decimal-format decimal-separator="." grouping-separator="," />
  24. <xsl:template match="/">
  25. <html>
  26. <head>
  27. <style type="text/css">
  28. .bannercell {
  29. border: 0px;
  30. padding: 0px;
  31. }
  32. body {
  33. margin: 0;
  34. font:normal 100% arial,helvetica,sanserif;
  35. background-color:#FFFFFF;
  36. color:#000000;
  37. }
  38. table.status {
  39. font:bold 80% arial,helvetica,sanserif;
  40. background-color:#525D76;
  41. color:#ffffff;
  42. }
  43. table.log tr td, tr th {
  44. font-size: 80%;
  45. }
  46. .error {
  47. color:red;
  48. }
  49. .warn {
  50. color:brown;
  51. }
  52. .info {
  53. color:gray;
  54. }
  55. .debug{
  56. color:gray;
  57. }
  58. .failed {
  59. font-size:80%;
  60. background-color: red;
  61. color:#FFFFFF;
  62. font-weight: bold
  63. }
  64. .complete {
  65. font-size:80%;
  66. background-color: #525D76;
  67. color:#FFFFFF;
  68. font-weight: bold
  69. }
  70. .a td {
  71. background: #efefef;
  72. }
  73. .b td {
  74. background: #fff;
  75. }
  76. th, td {
  77. text-align: left;
  78. vertical-align: top;
  79. }
  80. th {
  81. background: #ccc;
  82. color: black;
  83. }
  84. table, th, td {
  85. border: none
  86. }
  87. h3 {
  88. font:bold 80% arial,helvetica,sanserif;
  89. background: #525D76;
  90. color: white;
  91. text-decoration: none;
  92. padding: 5px;
  93. margin-right: 2px;
  94. margin-left: 2px;
  95. margin-bottom: 0;
  96. }
  97. </style>
  98. </head>
  99. <body>
  100. <!-- jakarta logo -->
  101. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  102. <tr>
  103. <td valign="top" class="bannercell">
  104. <a href="http://jakarta.apache.org/">
  105. <img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
  106. </a>
  107. </td>
  108. <td style="text-align:right;vertical-align:bottom">
  109. <a href="http://ant.apache.org/">Apache Ant</a>
  110. </td>
  111. </tr>
  112. </table>
  113. <table border="0" width="100%">
  114. <tr><td><hr noshade="yes" size="1"/></td></tr>
  115. </table>
  116. <xsl:apply-templates select="build"/>
  117. </body>
  118. </html>
  119. </xsl:template>
  120. <xsl:template match="build">
  121. <!-- build status -->
  122. <table width="100%">
  123. <xsl:attribute name="class">
  124. <xsl:if test="@error">failed</xsl:if>
  125. <xsl:if test="not(@error)">complete</xsl:if>
  126. </xsl:attribute>
  127. <tr>
  128. <xsl:if test="@error">
  129. <td nowrap="yes">Build Failed</td>
  130. </xsl:if>
  131. <xsl:if test="not(@error)">
  132. <td nowrap="yes">Build Complete</td>
  133. </xsl:if>
  134. <td style="text-align:right" nowrap="yes">Total Time: <xsl:value-of select="@time"/></td>
  135. </tr>
  136. <tr>
  137. <td colspan="2">
  138. <xsl:if test="@error">
  139. <tt><xsl:value-of select="@error"/></tt><br/>
  140. <i style="font-size:80%">See the <a href="#stacktrace" alt="Click for details">stacktrace</a>.</i>
  141. </xsl:if>
  142. </td>
  143. </tr>
  144. </table>
  145. <table border="1" cellspacing="2" cellpadding="3" width="100%" style="font-size:80%">
  146. <tr class="a"><td width="1">ant.file</td><td><xsl:value-of select="substring-after(//message[contains(text(),'ant.file')], '->')"/></td></tr>
  147. <tr class="b"><td width="1">ant.version</td><td><xsl:value-of select="substring-after(//message[contains(text(),'ant.version')], '->')"/></td></tr>
  148. <tr class="a"><td width="1">java.version</td><td><xsl:value-of select="substring-after(//message[contains(text(),'java.vm.version')], '->')"/></td></tr>
  149. <tr class="b"><td width="1">os.name</td><td><xsl:value-of select="substring-after(//message[contains(text(),'os.name')], '->')"/></td></tr>
  150. </table>
  151. <!-- build information -->
  152. <h3>Build events</h3>
  153. <table class="log" border="1" cellspacing="2" cellpadding="3" width="100%">
  154. <tr>
  155. <th nowrap="yes" align="left" width="1%">target</th>
  156. <th nowrap="yes" align="left" width="1%">task</th>
  157. <th nowrap="yes" align="left">message</th>
  158. </tr>
  159. <xsl:apply-templates select=".//message[@priority != 'debug']"/>
  160. </table>
  161. <p>
  162. <!-- stacktrace -->
  163. <xsl:if test="stacktrace">
  164. <a name="stacktrace"/>
  165. <h3>Error details</h3>
  166. <table width="100%">
  167. <tr><td>
  168. <pre><xsl:value-of select="stacktrace"/></pre>
  169. </td></tr>
  170. </table>
  171. </xsl:if>
  172. </p>
  173. </xsl:template>
  174. <!-- report every message but those with debug priority -->
  175. <xsl:template match="message[@priority!='debug']">
  176. <tr valign="top">
  177. <!-- alternated row style -->
  178. <xsl:attribute name="class">
  179. <xsl:if test="position() mod 2 = 1">a</xsl:if>
  180. <xsl:if test="position() mod 2 = 0">b</xsl:if>
  181. </xsl:attribute>
  182. <td nowrap="yes" width="1%"><xsl:value-of select="../../@name"/></td>
  183. <td nowrap="yes" style="text-align:right" width="1%">[ <xsl:value-of select="../@name"/> ]</td>
  184. <td class="{@priority}" nowrap="yes">
  185. <xsl:value-of select="text()"/>
  186. </td>
  187. </tr>
  188. </xsl:template>
  189. </xsl:stylesheet>