mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Mark Craig
11.04.2011 550273af92ba9085594de223f10bc8b6c0e7ad85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008-2009 Sun Microsystems, Inc.
 !      Portions Copyright 2011 ForgeRock AS
 ! -->
 
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
 
<xsl:template name="br-replace">
  <xsl:param name="text"/>
  <xsl:variable name="cr" select="'\n'"/>
  <xsl:choose>
    <!-- If the value of the $text parameter
            contains a carriage return... -->
    <xsl:when test="contains($text,$cr)">
      <!-- Return the substring of $text before the carriage return -->
      <xsl:value-of select="substring-before($text,$cr)"/>
      <!-- And construct a <br/> element -->
      <br/>
      <!--
       | Then invoke this same br-replace template again, passing the
       | substring *after* the carriage return as the new "$text" to
       | consider for replacement
       +-->
      <xsl:call-template name="br-replace">
        <xsl:with-param name="text" select="substring-after($text,$cr)"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text"/>
    </xsl:otherwise>
 </xsl:choose>
</xsl:template>
 
<xsl:template match="/">
  
  <xsl:element name="html">
 
    <xsl:variable name="group" select="qa/logs/log/@group"/>
    <xsl:variable name="suite" select="qa/logs/log/@suite"/>
    <xsl:variable name="parent" select="qa/logs/log/@parent"/>
    <xsl:variable name="jobid" select="qa/logs/log/@jobid"/>
  
    <xsl:element name="head">
  
    <style type="text/css">
      /* <![CDATA[ */
       @import "/branding/css/tigris.css";
       @import "/branding/css/inst.css";
       /* ]]> */
    </style>
    <link rel="stylesheet" type="text/css" href="/branding/css/print.css" media="print" />
    <link rel="stylesheet" href="../../reports/opends.css" type="text/css" />
  
      <xsl:element name="title">
        <xsl:value-of select="concat('Logs for ', $suite, ' test suite')"/>
      </xsl:element>
    
    </xsl:element>
    
    <table class="tertmasttable" width="100%" cellspacing="0">
      <tbody>
        <tr>
          <td><div class="collectionheader"><xsl:value-of select="concat('Logs for ', $suite, ' test suite')"/></div></td>
          <td width="10%"><a href="http://www.forgerock.com"><img src="../../reports/opendj_logo.png" alt="OpenDJ Logo" width="104" height="33" border="0" align="middle" /></a> </td>
        </tr>
      </tbody>
    </table>
    
    <!-- Shaded Line -->
    <xsl:element name="hr">
      <xsl:attribute name="noshade">
        <xsl:value-of select="'noshade'"/>
      </xsl:attribute>
      <xsl:attribute name="size">
        <xsl:value-of select="1"/>
      </xsl:attribute>
    </xsl:element>
 
    <!-- Baby Table -->
    <xsl:element name="table">
      <xsl:attribute name="border">
        <xsl:value-of select="'1'"/>
      </xsl:attribute> 
      <xsl:attribute name="cellpadding">
        <xsl:value-of select="'4'"/>
      </xsl:attribute>
    
      <xsl:element name="tr">
        <xsl:element name="td">
          <xsl:element name="b">
            <xsl:value-of select="'Test Group : '"/>
          </xsl:element>
          <xsl:value-of select="$group"/>
        </xsl:element>
        <xsl:element name="td">
          <xsl:element name="b">
            <xsl:value-of select="'Test Suite : '"/>
          </xsl:element>
          <xsl:value-of select="$suite"/>
        </xsl:element>
        <xsl:element name="td">
          <xsl:element name="b">
            <xsl:value-of select="'ParentID : '"/>
          </xsl:element>
          <xsl:value-of select="$parent"/>
        </xsl:element>
        <xsl:element name="td">
          <xsl:element name="b">
            <xsl:value-of select="'JobID : '"/>
          </xsl:element>
          <xsl:value-of select="$jobid"/>
        </xsl:element>
      </xsl:element>    
 
    </xsl:element>
 
    <!-- Shaded Line -->
    <xsl:element name="hr">
      <xsl:attribute name="noshade">
        <xsl:value-of select="'noshade'"/>
      </xsl:attribute>
      <xsl:attribute name="size">
        <xsl:value-of select="1"/>
      </xsl:attribute>
    </xsl:element>
  
    <xsl:element name="body">
 
      <xsl:element name="table">
      <xsl:attribute name="border">
        <xsl:value-of select="'1'"/>
      </xsl:attribute>
 
      <xsl:element name="tr">
        <xsl:element name="th">
          <xsl:value-of select="'Timestamp'"/>
        </xsl:element>
        <xsl:element name="th">
          <xsl:value-of select="'Level'"/>
        </xsl:element>
        <xsl:element name="th">
          <xsl:value-of select="'Message'"/>
        </xsl:element>
      </xsl:element>
 
      <xsl:variable name="log" select="qa/logs/log"/>
  
      <xsl:for-each select="$log/line">
 
        <xsl:element name="tr">
          <xsl:element name="td">
            <xsl:value-of select="@timestamp"/>
          </xsl:element>
          <xsl:element name="td">
            <xsl:choose>
              <xsl:when test="@level = 'Start'">              
                <xsl:element name="a">
                  <xsl:attribute name="name">
                    <xsl:value-of select="@tag"/>
                  </xsl:attribute>
                  <xsl:value-of select="@level"/>
                </xsl:element>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@level"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:element>
          <xsl:element name="td">
            <xsl:call-template name="br-replace">
              <xsl:with-param name="text" select="@message"/>
            </xsl:call-template>
          </xsl:element>
        </xsl:element>
 
      </xsl:for-each>
    
      </xsl:element>
      
    </xsl:element>
 
  </xsl:element>      
</xsl:template>
 
</xsl:stylesheet>