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