Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6803 buildadm 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="org.apache.xalan.lib.Redirect"
5
  extension-element-prefixes="redirect">
6
<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
7
<!--
8
   Licensed to the Apache Software Foundation (ASF) under one or more
9
   contributor license agreements.  See the NOTICE file distributed with
10
   this work for additional information regarding copyright ownership.
11
   The ASF licenses this file to You under the Apache License, Version 2.0
12
   (the "License"); you may not use this file except in compliance with
13
   the License.  You may obtain a copy of the License at
14
 
15
       http://www.apache.org/licenses/LICENSE-2.0
16
 
17
   Unless required by applicable law or agreed to in writing, software
18
   distributed under the License is distributed on an "AS IS" BASIS,
19
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
   See the License for the specific language governing permissions and
21
   limitations under the License.
22
 
23
-->
24
<!--
25
 
26
 Sample stylesheet to be used with JDepend XML output.
27
 
28
 It creates a set of HTML files a la javadoc where you can browse easily
29
 through all packages and classes.
30
 
31
  -->
32
<xsl:param name="output.dir" select="'.'"/>
33
 
34
<xsl:template match="JDepend">
35
   <!-- create the index.html -->
36
   <redirect:write file="{$output.dir}/index.html">
37
      <xsl:call-template name="index.html"/>
38
   </redirect:write>
39
 
40
  <!-- create the stylesheet.css -->
41
  <redirect:write file="{$output.dir}/stylesheet.css">
42
    <xsl:call-template name="stylesheet.css"/>
43
   </redirect:write>
44
 
45
   <!-- create the overview-packages.html at the root -->
46
  <redirect:write file="{$output.dir}/overview-summary.html">
47
    <xsl:apply-templates select="." mode="overview.packages"/>
48
  </redirect:write>
49
 
50
   <!-- create the overview-packages.html at the root -->
51
   <redirect:write file="{$output.dir}/overview-packages.html">
52
    <xsl:apply-templates select="." mode="packages.details"/>
53
  </redirect:write>
54
 
55
   <!-- create the overview-cycles.html at the root -->
56
   <redirect:write file="{$output.dir}/overview-cycles.html">
57
    <xsl:apply-templates select="." mode="cycles.details"/>
58
  </redirect:write>
59
 
60
   <!-- create the overview-cycles.html at the root -->
61
   <redirect:write file="{$output.dir}/overview-explanations.html">
62
    <xsl:apply-templates select="." mode="explanations"/>
63
  </redirect:write>
64
 
65
  <!-- create the all-packages.html at the root -->
66
   <redirect:write file="{$output.dir}/all-packages.html">
67
    <xsl:apply-templates select="Packages" mode="all.packages"/>
68
  </redirect:write>
69
 
70
  <!-- create the all-cycles.html at the root -->
71
  <redirect:write file="{$output.dir}/all-cycles.html">
72
    <xsl:apply-templates select="Cycles" mode="all.cycles"/>
73
  </redirect:write>
74
</xsl:template>
75
 
76
 
77
<xsl:template name="index.html">
78
<html>
79
   <head>
80
      <title>JDepend Analysis</title>
81
   </head>
82
      <frameset cols="20%,80%">
83
         <frameset rows="30%,70%">
84
            <frame src="all-packages.html" name="packageListFrame"/>
85
            <frame src="all-cycles.html" name="classListFrame"/>
86
         </frameset>
87
         <frame src="overview-summary.html" name="classFrame"/>
88
      </frameset>
89
      <noframes>
90
         <h2>Frame Alert</h2>
91
         <p>
92
            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.
93
         </p>
94
      </noframes>
95
</html>
96
</xsl:template>
97
 
98
<!-- this is the stylesheet css to use for nearly everything -->
99
<xsl:template name="stylesheet.css">
100
   <style type="text/css">
101
    body {
102
    font:normal 68% verdana,arial,helvetica;
103
    color:#000000;
104
    }
105
    table tr td, tr th {
106
      font-size: 68%;
107
    }
108
    table.details tr th{
109
    font-weight: bold;
110
    text-align:left;
111
    background:#a6caf0;
112
    }
113
    table.details tr td{
114
    background:#eeeee0;
115
    }
116
 
117
    p {
118
    line-height:1.5em;
119
    margin-top:0.5em; margin-bottom:1.0em;
120
    margin-left:2em;
121
    margin-right:2em;
122
    }
123
    h1 {
124
    margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
125
    }
126
    h2 {
127
    margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
128
    }
129
    h3 {
130
    margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
131
    }
132
    h4 {
133
    margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
134
    }
135
    h5 {
136
    margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
137
    }
138
    h6 {
139
    margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
140
    }
141
    .Error {
142
    font-weight:bold; color:red;
143
    }
144
    .Failure {
145
    font-weight:bold; color:purple;
146
    }
147
    .Properties {
148
    text-align:right;
149
    }
150
  </style>
151
</xsl:template>
152
 
153
<xsl:template match="JDepend" mode="overview.packages">
154
   <html>
155
      <head>
156
         <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
157
      </head>
158
      <body>
159
         <xsl:call-template name="pageHeader"/>
160
  <table width="100%"><tr align="left"><h2>Summary</h2><td>
161
  </td><td align="right">
162
  [summary]
163
  [<a href="overview-packages.html">packages</a>]
164
  [<a href="overview-cycles.html">cycles</a>]
165
  [<a href="overview-explanations.html">explanations</a>]
166
   </td></tr></table>
167
         <table width="100%" class="details">
168
            <tr>
169
               <th>Package</th>
170
               <th>Total Classes</th>
171
               <th><a href="overview-explanations.html#EXnumber">Abstract Classes</a></th>
172
               <th><a href="overview-explanations.html#EXnumber">Concrete Classes</a></th>
173
               <th><a href="overview-explanations.html#EXafferent">Afferent Couplings</a></th>
174
               <th><a href="overview-explanations.html#EXefferent">Efferent Couplings</a></th>
175
               <th><a href="overview-explanations.html#EXabstractness">Abstractness</a></th>
176
               <th><a href="overview-explanations.html#EXinstability">Instability</a></th>
177
               <th><a href="overview-explanations.html#EXdistance">Distance</a></th>
178
 
179
            </tr>
180
            <xsl:for-each select="./Packages/Package">
181
               <xsl:if test="count(error) = 0">
182
                  <tr>
183
                     <td align="left">
184
                        <a>
185
                           <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="@name"/>
186
                           </xsl:attribute>
187
                           <xsl:value-of select="@name"/>
188
                        </a>
189
                     </td>
190
                     <td align="right"><xsl:value-of select="Stats/TotalClasses"/></td>
191
                     <td align="right"><xsl:value-of select="Stats/AbstractClasses"/></td>
192
                     <td align="right"><xsl:value-of select="Stats/ConcreteClasses"/></td>
193
                     <td align="right"><xsl:value-of select="Stats/Ca"/></td>
194
                     <td align="right"><xsl:value-of select="Stats/Ce"/></td>
195
                     <td align="right"><xsl:value-of select="Stats/A"/></td>
196
                     <td align="right"><xsl:value-of select="Stats/I"/></td>
197
                     <td align="right"><xsl:value-of select="Stats/D"/></td>
198
                  </tr>
199
               </xsl:if>
200
            </xsl:for-each>
201
            <xsl:for-each select="./Packages/Package">
202
               <xsl:if test="count(error) &gt; 0">
203
                  <tr>
204
                     <td align="left">
205
                        <xsl:value-of select="@name"/>
206
                     </td>
207
                     <td align="left" colspan="8"><xsl:value-of select="error"/></td>
208
                  </tr>
209
               </xsl:if>
210
            </xsl:for-each>
211
         </table>
212
      </body>
213
   </html>
214
</xsl:template>
215
 
216
<xsl:template match="JDepend" mode="packages.details">
217
   <html>
218
      <head>
219
          <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
220
      </head>
221
      <body>
222
         <xsl:call-template name="pageHeader"/>
223
  <table width="100%"><tr align="left"><h2>Packages</h2><td>
224
  </td><td align="right">
225
  [<a href="overview-summary.html">summary</a>]
226
  [packages]
227
  [<a href="overview-cycles.html">cycles</a>]
228
  [<a href="overview-explanations.html">explanations</a>]
229
   </td></tr></table>
230
 
231
  <xsl:for-each select="./Packages/Package">
232
    <xsl:if test="count(error) = 0">
233
      <h3><a><xsl:attribute name="name">PK<xsl:value-of select="@name"/></xsl:attribute>
234
      <xsl:value-of select="@name"/></a></h3>
235
 
236
      <table width="100%"><tr>
237
        <td><a href="overview-explanations.html#EXafferent">Afferent Couplings</a>: <xsl:value-of select="Stats/Ca"/></td>
238
        <td><a href="overview-explanations.html#EXefferent">Efferent Couplings</a>: <xsl:value-of select="Stats/Ce"/></td>
239
        <td><a href="overview-explanations.html#EXabstractness">Abstractness</a>: <xsl:value-of select="Stats/A"/></td>
240
        <td><a href="overview-explanations.html#EXinstability">Instability</a>: <xsl:value-of select="Stats/I"/></td>
241
        <td><a href="overview-explanations.html#EXdistance">Distance</a>: <xsl:value-of select="Stats/D"/></td>
242
      </tr></table>
243
 
244
      <table width="100%" class="details">
245
        <tr>
246
          <th>Abstract Classes</th>
247
          <th>Concrete Classes</th>
248
          <th>Used by Packages</th>
249
          <th>Uses Packages</th>
250
        </tr>
251
        <tr>
252
          <td valign="top" width="25%">
253
          <xsl:if test="count(AbstractClasses/Class)=0">
254
              <i>None</i>
255
            </xsl:if>
256
            <xsl:for-each select="AbstractClasses/Class">
257
              <xsl:value-of select="node()"/><br/>
258
            </xsl:for-each>
259
          </td>
260
          <td valign="top" width="25%">
261
            <xsl:if test="count(ConcreteClasses/Class)=0">
262
              <i>None</i>
263
            </xsl:if>
264
            <xsl:for-each select="ConcreteClasses/Class">
265
              <xsl:value-of select="node()"/><br/>
266
            </xsl:for-each>
267
          </td>
268
          <td valign="top" width="25%">
269
            <xsl:if test="count(UsedBy/Package)=0">
270
              <i>None</i>
271
            </xsl:if>
272
            <xsl:for-each select="UsedBy/Package">
273
              <a>
274
                        <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="node()"/></xsl:attribute>
275
                <xsl:value-of select="node()"/>
276
              </a><br/>
277
            </xsl:for-each>
278
          </td>
279
          <td valign="top" width="25%">
280
            <xsl:if test="count(DependsUpon/Package)=0">
281
              <i>None</i>
282
            </xsl:if>
283
            <xsl:for-each select="DependsUpon/Package">
284
              <a>
285
                        <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="node()"/></xsl:attribute>
286
                <xsl:value-of select="node()"/>
287
              </a><br/>
288
            </xsl:for-each>
289
          </td>
290
        </tr>
291
      </table>
292
    </xsl:if>
293
  </xsl:for-each>
294
  <!-- this is often a long listing; provide a lower navigation table also -->
295
  <table width="100%"><tr align="left"><td></td><td align="right">
296
  [<a href="overview-summary.html">summary</a>]
297
  [packages]
298
  [<a href="overview-cycles.html">cycles</a>]
299
  [<a href="overview-explanations.html">explanations</a>]
300
   </td></tr></table>
301
      </body>
302
   </html>
303
</xsl:template>
304
 
305
<xsl:template match="JDepend" mode="cycles.details">
306
   <html>
307
      <head>
308
         <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
309
      </head>
310
      <body>
311
         <xsl:call-template name="pageHeader"/>
312
  <table width="100%"><tr align="left"><h2>Cycles</h2><td>
313
  </td><td align="right">
314
  [<a href="overview-summary.html">summary</a>]
315
  [<a href="overview-packages.html">packages</a>]
316
  [cycles]
317
  [<a href="overview-explanations.html">explanations</a>]
318
   </td></tr></table>
319
  <!--<table width="100%"><tr><td>
320
  </td><td align="right">
321
    [<a href="#NVsummary">summary</a>]
322
  [<a href="#NVpackages">packages</a>]
323
  [<a href="#NVcycles">cycles</a>]
324
   [<a href="#NVexplanations">explanations</a>]
325
  </td></tr></table> -->
326
 
327
  <xsl:if test="count(Cycles/Package) = 0">
328
    <p>There are no cyclic dependancies.</p>
329
  </xsl:if>
330
  <xsl:for-each select="Cycles/Package">
331
     <h3><a><xsl:attribute name="name">#CY<xsl:value-of select="@Name"/></xsl:attribute><xsl:value-of select="@Name"/></a></h3><p>
332
    <xsl:for-each select="Package">
333
      <xsl:value-of select="."/><br/>
334
    </xsl:for-each></p>
335
  </xsl:for-each>
336
  <!-- this is often a long listing; provide a lower navigation table also -->
337
  <table width="100%"><tr align="left"><td></td><td align="right">
338
  [<a href="overview-summary.html">summary</a>]
339
  [<a href="overview-packages.html">packages</a>]
340
  [cycles]
341
  [<a href="overview-explanations.html">explanations</a>]
342
   </td></tr></table>
343
  </body>
344
  </html>
345
</xsl:template>
346
 
347
<xsl:template match="JDepend" mode="explanations">
348
   <html>
349
      <head>
350
         <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
351
      </head>
352
      <body>
353
         <xsl:call-template name="pageHeader"/>
354
 
355
  <table width="100%"><tr align="left"><h2>Explanations</h2><td>
356
  </td><td align="right">
357
  [<a href="overview-summary.html">summary</a>]
358
  [<a href="overview-packages.html">packages</a>]
359
  [<a href="overview-cycles.html">cycles</a>]
360
  [explanations]
361
   </td></tr></table>
362
 
363
  <p>The following explanations are for quick reference and are lifted directly from the original <a href="http://www.clarkware.com/software/JDepend.html">JDepend documentation</a>.</p>
364
 
365
  <h3><a name="EXnumber">Number of Classes</a></h3>
366
    <p>The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.</p>
367
  <h3><a name="EXafferent">Afferent Couplings</a></h3>
368
    <p>The number of other packages that depend upon classes within the package is an indicator of the package's responsibility. </p>
369
  <h3><a name="EXefferent">Efferent Couplings</a></h3>
370
    <p>The number of other packages that the classes in the package depend upon is an indicator of the package's independence. </p>
371
  <h3><a name="EXabstractness">Abstractness</a></h3>
372
    <p>The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package. </p>
373
    <p>The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package. </p>
374
  <h3><a name="EXinstability">Instability</a></h3>
375
    <p>The ratio of efferent coupling (Ce) to total coupling (Ce / (Ce + Ca)). This metric is an indicator of the package's resilience to change. </p>
376
    <p>The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package. </p>
377
  <h3><a name="EXdistance">Distance</a></h3>
378
    <p>The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability. </p>
379
    <p>A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0). </p>
380
    <p>The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible. </p>
381
 
382
      </body>
383
   </html>
384
</xsl:template>
385
 
386
 
387
<!--
388
Creates an html file that contains a link to all package links in overview-packages.html.
389
  @bug there will be a problem here, I don't know yet how to handle unnamed package :(
390
-->
391
<xsl:template match="JDepend/Packages" mode="all.packages">
392
  <html>
393
    <head>
394
      <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
395
    </head>
396
    <body>
397
  <table width="100%"><tr align="left"><td></td><td nowrap="nowrap" align="right">
398
  [<a href="overview-summary.html" target="classFrame">summary</a>]
399
  [<a href="overview-packages.html" target="classFrame">packages</a>]
400
  [<a href="overview-cycles.html" target="classFrame">cycles</a>]
401
  [<a href="overview-explanations.html" target="classFrame">explanations</a>]
402
   </td></tr></table>
403
      <h2>Packages</h2>
404
        <table width="100%">
405
          <xsl:apply-templates select="Package[count(error)=0]" mode="all.packages.link">
406
            <xsl:sort select="@name"/>
407
          </xsl:apply-templates>
408
          <xsl:apply-templates select="Package[count(error) &gt; 0]" mode="all.packages.nolink">
409
            <xsl:sort select="@name"/>
410
          </xsl:apply-templates>
411
        </table>
412
    </body>
413
  </html>
414
</xsl:template>
415
 
416
<xsl:template match="JDepend/Packages/Package" mode="all.packages.link">
417
  <tr>
418
    <td nowrap="nowrap">
419
         <a href="overview-packages.html#PK{@name}" target="classFrame">
420
        <xsl:value-of select="@name"/>
421
      </a>
422
    </td>
423
  </tr>
424
</xsl:template>
425
 
426
<!--
427
I do not know JDepend enough to know if every error results in a non-analyzed package,
428
but that is how I am presenting it to the viewer.  This may need to change.
429
  @bug there will be a problem here, I don't know yet how to handle unnamed package :(
430
-->
431
<xsl:template match="JDepend/Packages/Package" mode="all.packages.nolink">
432
  <tr>
433
    <td nowrap="nowrap">
434
       Not Analyzed: <xsl:value-of select="@name"/>
435
    </td>
436
  </tr>
437
</xsl:template>
438
 
439
<!--
440
Creates an html file that contains a link to all package links in overview-cycles.html.
441
  @bug there will be a problem here, I don't know yet how to handle unnamed package :(
442
-->
443
<xsl:template match="JDepend/Cycles" mode="all.cycles">
444
  <html>
445
    <head>
446
      <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
447
    </head>
448
    <body>
449
  <table width="100%"><tr align="left"><td></td><td nowrap="nowrap" align="right">
450
  [<a href="overview-summary.html" target="classFrame">summary</a>]
451
  [<a href="overview-packages.html" target="classFrame">packages</a>]
452
  [<a href="overview-cycles.html" target="classFrame">cycles</a>]
453
  [<a href="overview-explanations.html" target="classFrame">explanations</a>]
454
   </td></tr></table>
455
      <h2>Cycles</h2>
456
        <table width="100%">
457
           <xsl:apply-templates select="Package" mode="all.cycles">
458
            <xsl:sort select="@Name"/>
459
          </xsl:apply-templates>
460
        </table>
461
    </body>
462
  </html>
463
</xsl:template>
464
 
465
<xsl:template match="JDepend/Cycles/Package" mode="all.cycles">
466
  <tr>
467
    <td nowrap="nowrap">
468
         <a href="overview-cycles.html#CY{@Name}" target="classFrame"><xsl:value-of select="@Name"/></a>
469
    </td>
470
  </tr>
471
</xsl:template>
472
 
473
<!-- Page HEADER -->
474
<xsl:template name="pageHeader">
475
   <h1>JDepend Analysis</h1>
476
  <table width="100%">
477
  <tr>
478
    <td align="left"></td>
479
      <td align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="http://jakarta.apache.org">Ant</a>.</td>
480
  </tr>
481
  </table>
482
  <hr size="1"/>
483
</xsl:template>
484
 
485
</xsl:stylesheet>