• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8" ?>
2<!--
3  Copyright (C) 2005, 2006 Etienne Giraudy, InStranet Inc
4
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18-->
19
20<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
21   <xsl:output
22         method="xml" indent="yes"
23         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
24         doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
25         encoding="UTF-8"/>
26
27    <!--
28        Parameter for specifying HTMLized sources location; if current dir, use "./"
29        If not passed, no links to sources are generated.
30        because of back-compatibility reasons.
31        The source filename should be package.class.java.html
32        The source can have line no anchors like #11 -->
33    <xsl:param name="htmlsrcpath"></xsl:param>
34
35   <!--xsl:key name="lbc-category-key"    match="/BugCollection/BugInstance" use="@category" /-->
36   <xsl:key name="lbc-code-key"        match="/BugCollection/BugInstance" use="concat(@category,@abbrev)" />
37   <xsl:key name="lbc-bug-key"         match="/BugCollection/BugInstance" use="concat(@category,@abbrev,@type)" />
38   <xsl:key name="lbp-class-b-t"  match="/BugCollection/BugInstance" use="concat(Class/@classname,@type)" />
39
40<xsl:template match="/" >
41
42<html>
43   <head>
44      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
45      <title>
46        FindBugs (<xsl:value-of select="/BugCollection/@version" />)
47         Analysis for
48         <xsl:choose>
49            <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when>
50            <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise>
51         </xsl:choose>
52      </title>
53      <script type="text/javascript">
54         function show(foo) {
55            document.getElementById(foo).style.display="block";
56         }
57         function hide(foo) {
58            document.getElementById(foo).style.display="none";
59         }
60         function toggle(foo) {
61            if( document.getElementById(foo).style.display == "none") {
62               show(foo);
63            } else {
64               if( document.getElementById(foo).style.display == "block") {
65                  hide(foo);
66               } else {
67                  show(foo);
68               }
69            }
70         }
71
72         function showmenu(foo) {
73            if( document.getElementById(foo).style.display == "none") {
74               hide("bug-summary");
75               document.getElementById("bug-summary-tab").className="menu-tab";
76               hide("analysis-data");
77               document.getElementById("analysis-data-tab").className="menu-tab";
78               //hide("list-by-b-t");
79               //document.getElementById("list-by-b-t-tab").className="menu-tab";
80               hide("list-by-package");
81               document.getElementById("list-by-package-tab").className="menu-tab";
82               hide("list-by-category");
83               document.getElementById("list-by-category-tab").className="menu-tab";
84               document.getElementById(foo+"-tab").className="menu-tab-selected";
85               show(foo);
86
87            }
88            // else menu already selected!
89         }
90         function showbug(buguid, list) {
91            var bugplaceholder   = document.getElementById(buguid+'-ph-'+list);
92            var bug              = document.getElementById(buguid);
93
94            if ( bugplaceholder==null) {
95               alert(buguid+'-ph-'+list+' - '+buguid+' - bugplaceholder==null');
96               return;
97            }
98            if ( bug==null) {
99               alert(buguid+'-ph-'+list+' - '+buguid+' - bug==null');
100               return;
101            }
102
103            var oldBug = bugplaceholder.innerHTML;
104            var newBug = bug.innerHTML;
105            //alert(oldBug);
106            //alert(newBug);
107            toggle(buguid+'-ph-'+list);
108            bugplaceholder.innerHTML = newBug;
109         }
110      </script>
111      <script type='text/javascript'><xsl:text disable-output-escaping='yes'>
112     /* <![CDATA[ */
113         // Extended Tooltip Javascript
114         // copyright 9th August 2002, 3rd July 2005
115         // by Stephen Chapman, Felgall Pty Ltd
116
117         // permission is granted to use this javascript provided that the below code is not altered
118         var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if (navigator.appName.indexOf('Netscape') != -1) if (browserVersion == 4) {an = 1; DH = 1;}}}
119         function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
120         function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
121         function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
122         function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
123         function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}
124  /* ]]> */
125</xsl:text></script>
126      <style type='text/css'>
127         html, body {
128            background-color: #ffffff;
129         }
130         a, a:link , a:active, a:visited, a:hover {
131            text-decoration: none; color: black;
132         }
133         .b-r a {
134            text-decoration: underline; color: blue;
135         }
136         div, span {
137            vertical-align: top;
138         }
139         p {
140            margin: 0px;
141         }
142         h1 {
143            /*font-size: 14pt;*/
144            color: red;
145         }
146         #menu {
147            margin-bottom: 10px;
148         }
149         #menu ul {
150            margin-left: 0;
151            padding-left: 0;
152            display: inline;
153         }
154         #menu ul li {
155            margin-left: 0;
156            margin-bottom: 0;
157            padding: 2px 15px 5px;
158            border: 1px solid #000;
159            list-style: none;
160            display: inline;
161         }
162         #menu ul li.here {
163            border-bottom: 1px solid #ffc;
164            list-style: none;
165            display: inline;
166         }
167         .menu-tab {
168            background: white;
169         }
170         .menu-tab:hover {
171            background: grey;
172         }
173         .menu-tab-selected {
174            background: #aaaaaa;
175         }
176         #analysis-data ul {
177            margin-left: 15px;
178         }
179         #analyzed-files, #used-libraries, #analysis-error {
180           margin: 2px;
181           border: 1px black solid;
182           padding: 2px;
183           float: left;
184           overflow:auto;
185         }
186         #analyzed-files {
187           width: 25%;
188         }
189         #used-libraries {
190           width: 25%;
191         }
192         #analysis-error {
193           width: 40%;
194         }
195         div.summary {
196            width:100%;
197            text-align:left;
198         }
199         .summary table {
200            border:1px solid black;
201         }
202         .summary th {
203            background: #aaaaaa;
204            color: white;
205         }
206         .summary th, .summary td {
207            padding: 2px 4px 2px 4px;
208         }
209         .summary-name {
210            background: #eeeeee;
211            text-align:left;
212         }
213         .summary-size {
214            background: #eeeeee;
215            text-align:center;
216         }
217         .summary-ratio {
218            background: #eeeeee;
219            text-align:center;
220         }
221         .summary-priority-all {
222            background: #dddddd;
223            text-align:center;
224         }
225         .summary-priority-1 {
226            background: red;
227            text-align:center;
228         }
229         .summary-priority-2 {
230            background: orange;
231            text-align:center;
232         }
233         .summary-priority-3 {
234            background: green;
235            text-align:center;
236         }
237         .summary-priority-4 {
238            background: blue;
239            text-align:center;
240         }
241         .ob {
242            border: 1px solid black;
243            margin: 10px;
244         }
245         .ob-t {
246            border-bottom: 1px solid #000000; font-size: 12pt; font-weight: bold;
247            background: #cccccc; margin: 0; padding: 0 5px 0 5px;
248         }
249         .t-h {
250            font-weight: normal;
251         }
252         .ib-1, .ib-2 {
253            margin: 0 0 0 10px;
254         }
255         .ib-1-t, .ib-2-t {
256            border-bottom: 1px solid #000000; border-left: 1px solid #000000;
257            margin: 0; padding: 0 5px 0 5px;
258            font-size: 12pt; font-weight: bold; background: #cccccc;
259         }
260         .bb {
261            border-bottom: 1px solid #000000; border-left: 1px solid #000000;
262         }
263         .b-1 {
264            background: red; height: 0.5em; width: 1em;
265            margin-right: 0.5em;
266         }
267         .b-2 {
268            background: orange; height: 0.5em; width: 1em;
269            margin-right: 0.5em;
270         }
271         .b-3 {
272            background: green; height: 0.5em; width: 1em;
273            margin-right: 0.5em;
274         }
275         .b-4 {
276            background: blue; height: 0.5em; width: 1em;
277            margin-right: 0.5em;
278         }
279         .b-t {
280         }
281         .b-r {
282            font-size: 10pt; font-weight: bold; padding: 0 0 0 60px;
283         }
284         .b-d {
285            font-weight: normal; background: #eeeee0;
286            padding: 0 5px 0 5px; margin: 0px;
287         }
288         .bug-placeholder {
289            top:140px;
290            border:1px solid black;
291            display:none;
292         }
293         .tip {
294            border:solid 1px #666666;
295            width:600px;
296            padding:3px;
297            position:absolute;
298            z-index:100;
299            visibility:hidden;
300            color:#333333;
301            top:20px;
302            left:90px;
303            background-color:#ffffcc;
304            layer-background-color:#ffffcc;
305         }
306
307
308      </style>
309   </head>
310   <body>
311   <div id='content'>
312      <h1>
313         FindBugs (<xsl:value-of select="/BugCollection/@version" />)
314         Analysis for
315         <xsl:choose>
316            <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when>
317            <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise>
318         </xsl:choose>
319      </h1>
320      <div id="menu">
321         <ul>
322            <li id='bug-summary-tab' class='menu-tab-selected'>
323               <xsl:attribute name="onclick">showmenu('bug-summary');return false;</xsl:attribute>
324               <a href='' onclick='return false;'>Bug Summary</a>
325            </li>
326            <li id='analysis-data-tab' class='menu-tab'>
327               <xsl:attribute name="onclick">showmenu('analysis-data');return false;</xsl:attribute>
328               <a href='' onclick='return false;'>Analysis Information</a>
329            </li>
330            <li id='list-by-category-tab' class='menu-tab'>
331               <xsl:attribute name="onclick">showmenu('list-by-category');return false;</xsl:attribute>
332               <a href='' onclick='return false;'>List bugs by bug category</a>
333            </li>
334            <li id='list-by-package-tab' class='menu-tab'>
335               <xsl:attribute name="onclick">showmenu('list-by-package');return false;</xsl:attribute>
336               <a href='' onclick='return false;'>List bugs by package</a>
337            </li>
338         </ul>
339      </div>
340      <xsl:call-template name="generateSummary" />
341      <xsl:call-template name="analysis-data" />
342      <xsl:call-template name="list-by-category" />
343      <xsl:call-template name="list-by-package" />
344
345
346      <!-- advanced tooltips -->
347      <xsl:for-each select="/BugCollection/BugPattern">
348         <xsl:variable name="b-t"><xsl:value-of select="@type" /></xsl:variable>
349         <div>
350            <xsl:attribute name="id">tip-<xsl:value-of select="$b-t" /></xsl:attribute>
351            <xsl:attribute name="class">tip</xsl:attribute>
352            <b><xsl:value-of select="@abbrev" /> / <xsl:value-of select="@type" /></b><br/>
353            <xsl:value-of select="/BugCollection/BugPattern[@type=$b-t]/Details" disable-output-escaping="yes" />
354         </div>
355      </xsl:for-each>
356
357      <!-- bug descriptions - hidden -->
358      <xsl:for-each select="/BugCollection/BugInstance[not(@last)]">
359            <div style="display:none;">
360               <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:attribute>
361               <xsl:for-each select="*/Message">
362                   <xsl:choose>
363                    <xsl:when test="parent::SourceLine and $htmlsrcpath != '' ">
364                      <div class="b-r"><a>
365                        <xsl:attribute name="href"><xsl:value-of select="$htmlsrcpath"/><xsl:value-of select="../@sourcepath" />.html#<xsl:value-of select="../@start" /></xsl:attribute>
366                        <xsl:apply-templates />
367                      </a></div>
368                    </xsl:when>
369                    <xsl:otherwise>
370                      <div class="b-r"><xsl:apply-templates /></div>
371                    </xsl:otherwise>
372                   </xsl:choose>
373               </xsl:for-each>
374               <div class="b-d">
375                  <xsl:value-of select="LongMessage" disable-output-escaping="no" />
376               </div>
377            </div>
378      </xsl:for-each>
379   </div>
380   <div id='fixedbox'>
381      <div id='bug-placeholder'></div>
382   </div>
383   </body>
384</html>
385</xsl:template>
386
387<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
388<!-- generate summary report from stats -->
389<xsl:template name="generateSummary" >
390<div class='summary' id='bug-summary'>
391   <h2>FindBugs Analysis generated at: <xsl:value-of select="/BugCollection/FindBugsSummary/@timestamp" /></h2>
392   <table>
393      <tr>
394         <th>Package</th>
395         <th>Code Size</th>
396         <th>Bugs</th>
397         <th>High Prio Bugs</th>
398         <th>Medium Prio Bugs</th>
399         <th>Low Prio Bugs</th>
400         <th>Exp. Bugs</th>
401         <th>Ratio</th>
402      </tr>
403      <tr>
404         <td class='summary-name'>
405            Overall
406            (<xsl:value-of select="/BugCollection/FindBugsSummary/@num_packages" /> packages),
407            (<xsl:value-of select="/BugCollection/FindBugsSummary/@total_classes" /> classes)
408         </td>
409         <td class='summary-size'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_size" /></td>
410         <td class='summary-priority-all'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_bugs" /></td>
411         <td class='summary-priority-1'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_1" /></td>
412         <td class='summary-priority-2'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_2" /></td>
413         <td class='summary-priority-3'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_3" /></td>
414         <td class='summary-priority-4'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_4" /></td>
415         <td class='summary-ratio'></td>
416      </tr>
417      <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats">
418         <xsl:sort select="@package" />
419         <xsl:if test="@total_bugs!='0'" >
420            <tr>
421               <td class='summary-name'><xsl:value-of select="@package" /></td>
422               <td class='summary-size'><xsl:value-of select="@total_size" /></td>
423               <td class='summary-priority-all'><xsl:value-of select="@total_bugs" /></td>
424               <td class='summary-priority-1'><xsl:value-of select="@priority_1" /></td>
425               <td class='summary-priority-2'><xsl:value-of select="@priority_2" /></td>
426               <td class='summary-priority-3'><xsl:value-of select="@priority_3" /></td>
427               <td class='summary-priority-4'><xsl:value-of select="@priority_4" /></td>
428               <td class='summary-ratio'></td>
429<!--
430               <xsl:for-each select="ClassStats">
431                  <xsl:if test="@bugs!='0'" >
432                  <li>
433                     <xsl:value-of select="@class" /> - total: <xsl:value-of select="@bugs" />
434                  </li>
435                  </xsl:if>
436               </xsl:for-each>
437-->
438            </tr>
439         </xsl:if>
440      </xsl:for-each>
441   </table>
442</div>
443</xsl:template>
444
445<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
446<!-- display analysis info -->
447<xsl:template name="analysis-data">
448      <div id='analysis-data' style='display:none;'>
449         <div id='analyzed-files'>
450            <h3>Analyzed Files:</h3>
451            <ul>
452               <xsl:for-each select="/BugCollection/Project/Jar">
453                  <li><xsl:apply-templates /></li>
454               </xsl:for-each>
455            </ul>
456         </div>
457         <div id='used-libraries'>
458            <h3>Used Libraries:</h3>
459            <ul>
460               <xsl:for-each select="/BugCollection/Project/AuxClasspathEntry">
461                  <li><xsl:apply-templates /></li>
462               </xsl:for-each>
463               <xsl:if test="count(/BugCollection/Project/AuxClasspathEntry)=0" >
464                  <li>None</li>
465               </xsl:if>
466            </ul>
467         </div>
468         <div id='analysis-error'>
469            <h3>Analysis Errors:</h3>
470            <ul>
471               <xsl:variable name="error-count"
472                             select="count(/BugCollection/Errors/MissingClass)" />
473               <xsl:if test="$error-count=0" >
474                  <li>None</li>
475               </xsl:if>
476               <xsl:if test="$error-count>0" >
477                  <li>Missing ref classes for analysis:
478                     <ul>
479                        <xsl:for-each select="/BugCollection/Errors/MissingClass">
480                           <li><xsl:apply-templates /></li>
481                        </xsl:for-each>
482                     </ul>
483                  </li>
484               </xsl:if>
485            </ul>
486         </div>
487      </div>
488</xsl:template>
489
490<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
491<!-- show priorities helper -->
492<xsl:template name="helpPriorities">
493   <span>
494      <xsl:attribute name="class">b-1</xsl:attribute>
495      <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
496   </span> High Prio
497   <span>
498      <xsl:attribute name="class">b-2</xsl:attribute>
499      <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
500   </span> Medium Prio
501   <span>
502      <xsl:attribute name="class">b-3</xsl:attribute>
503      <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
504   </span> Low Prio
505   <span>
506      <xsl:attribute name="class">b-4</xsl:attribute>
507      <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
508   </span> Exp.
509</xsl:template>
510
511<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
512<!-- display the details of a bug -->
513<xsl:template name="display-bug" >
514   <xsl:param name="b-t"    select="''" />
515   <xsl:param name="bug-id"      select="''" />
516   <xsl:param name="which-list"  select="''" />
517   <div class="bb">
518      <a>
519         <xsl:attribute name="href"></xsl:attribute>
520         <xsl:attribute name="onclick">showbug('b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />','<xsl:value-of select="$which-list" />');return false;</xsl:attribute>
521         <span>
522            <xsl:attribute name="class">b-<xsl:value-of select="@priority"/></xsl:attribute>
523            <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
524         </span>
525         <span class="b-t"><xsl:value-of select="@abbrev" />: </span> <xsl:value-of select="Class/Message" />
526      </a>
527      <div style="display:none;">
528         <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />-ph-<xsl:value-of select="$which-list" /></xsl:attribute>
529         loading...
530      </div>
531   </div>
532</xsl:template>
533
534<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
535<!-- main template for the list by category -->
536<xsl:template name="list-by-category" >
537   <div id='list-by-category' class='data-box' style='display:none;'>
538      <xsl:call-template name="helpPriorities" />
539      <xsl:variable name="unique-category" select="/BugCollection/BugCategory/@category"/>
540      <xsl:for-each select="$unique-category">
541         <xsl:sort select="." order="ascending" />
542            <xsl:call-template name="categories">
543               <xsl:with-param name="category" select="." />
544            </xsl:call-template>
545      </xsl:for-each>
546   </div>
547</xsl:template>
548
549<xsl:template name="categories" >
550   <xsl:param name="category" select="''" />
551   <xsl:variable name="category-count"
552                       select="count(/BugCollection/BugInstance[@category=$category and not(@last)])" />
553   <xsl:variable name="category-count-p1"
554                       select="count(/BugCollection/BugInstance[@category=$category and @priority='1' and not(@last)])" />
555   <xsl:variable name="category-count-p2"
556                       select="count(/BugCollection/BugInstance[@category=$category and @priority='2' and not(@last)])" />
557   <xsl:variable name="category-count-p3"
558                       select="count(/BugCollection/BugInstance[@category=$category and @priority='3' and not(@last)])" />
559   <xsl:variable name="category-count-p4"
560                       select="count(/BugCollection/BugInstance[@category=$category and @priority='4' and not(@last)])" />
561   <div class='ob'>
562      <div class='ob-t'>
563         <a>
564            <xsl:attribute name="href"></xsl:attribute>
565            <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />');return false;</xsl:attribute>
566            <xsl:value-of select="/BugCollection/BugCategory[@category=$category]/Description" />
567            (<xsl:value-of select="$category-count" />:
568            <span class='t-h'><xsl:value-of select="$category-count-p1" />/<xsl:value-of select="$category-count-p2" />/<xsl:value-of select="$category-count-p3" />/<xsl:value-of select="$category-count-p4" /></span>)
569         </a>
570      </div>
571      <div style="display:none;">
572         <xsl:attribute name="id">category-<xsl:value-of select="$category" /></xsl:attribute>
573         <xsl:call-template name="list-by-category-and-code">
574            <xsl:with-param name="category" select="$category" />
575         </xsl:call-template>
576      </div>
577   </div>
578</xsl:template>
579
580<xsl:template name="list-by-category-and-code" >
581   <xsl:param name="category" select="''" />
582   <xsl:variable name="unique-code" select="/BugCollection/BugInstance[@category=$category and not(@last) and generate-id()= generate-id(key('lbc-code-key',concat(@category,@abbrev)))]/@abbrev" />
583   <xsl:for-each select="$unique-code">
584      <xsl:sort select="." order="ascending" />
585         <xsl:call-template name="codes">
586            <xsl:with-param name="category" select="$category" />
587            <xsl:with-param name="code" select="." />
588         </xsl:call-template>
589   </xsl:for-each>
590</xsl:template>
591
592<xsl:template name="codes" >
593   <xsl:param name="category" select="''" />
594   <xsl:param name="code"     select="''" />
595   <xsl:variable name="code-count"
596                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and not(@last)])" />
597   <xsl:variable name="code-count-p1"
598                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='1' and not(@last)])" />
599   <xsl:variable name="code-count-p2"
600                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='2' and not(@last)])" />
601   <xsl:variable name="code-count-p3"
602                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='3' and not(@last)])" />
603   <xsl:variable name="code-count-p4"
604                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='4' and not(@last)])" />
605   <div class='ib-1'>
606      <div class="ib-1-t">
607         <a>
608            <xsl:attribute name="href"></xsl:attribute>
609            <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />');return false;</xsl:attribute>
610            <xsl:value-of select="$code" />: <xsl:value-of select="/BugCollection/BugCode[@abbrev=$code]/Description" />
611            (<xsl:value-of select="$code-count" />:
612            <span class='t-h'><xsl:value-of select="$code-count-p1" />/<xsl:value-of select="$code-count-p2" />/<xsl:value-of select="$code-count-p3" />/<xsl:value-of select="$code-count-p4" /></span>)
613         </a>
614      </div>
615      <div style="display:none;">
616         <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" /></xsl:attribute>
617         <xsl:call-template name="list-by-category-and-code-and-bug">
618            <xsl:with-param name="category" select="$category" />
619            <xsl:with-param name="code" select="$code" />
620         </xsl:call-template>
621      </div>
622   </div>
623</xsl:template>
624
625<xsl:template name="list-by-category-and-code-and-bug" >
626   <xsl:param name="category" select="''" />
627   <xsl:param name="code" select="''" />
628   <xsl:variable name="unique-bug" select="/BugCollection/BugInstance[@category=$category and not(@last) and @abbrev=$code and generate-id()= generate-id(key('lbc-bug-key',concat(@category,@abbrev,@type)))]/@type" />
629   <xsl:for-each select="$unique-bug">
630      <xsl:sort select="." order="ascending" />
631         <xsl:call-template name="bugs">
632            <xsl:with-param name="category" select="$category" />
633            <xsl:with-param name="code" select="$code" />
634            <xsl:with-param name="bug" select="." />
635         </xsl:call-template>
636   </xsl:for-each>
637</xsl:template>
638
639<xsl:template name="bugs" >
640   <xsl:param name="category" select="''" />
641   <xsl:param name="code"     select="''" />
642   <xsl:param name="bug"      select="''" />
643   <xsl:variable name="bug-count"
644                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and not(@last)])" />
645   <xsl:variable name="bug-count-p1"
646                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='1' and not(@last)])" />
647   <xsl:variable name="bug-count-p2"
648                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='2' and not(@last)])" />
649   <xsl:variable name="bug-count-p3"
650                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='3' and not(@last)])" />
651   <xsl:variable name="bug-count-p4"
652                       select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='4' and not(@last)])" />
653   <div class='ib-2'>
654      <div class='ib-2-t'>
655         <a>
656            <xsl:attribute name="href"></xsl:attribute>
657            <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" />');return false;</xsl:attribute>
658            <xsl:attribute name="onmouseout">popUp(event,'tip-<xsl:value-of select="$bug" />');</xsl:attribute>
659            <xsl:attribute name="onmouseover">popUp(event,'tip-<xsl:value-of select="$bug" />');</xsl:attribute>
660            <xsl:value-of select="/BugCollection/BugPattern[@category=$category and @abbrev=$code and @type=$bug]/ShortDescription" /><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
661            (<xsl:value-of select="$bug-count" />:
662            <span class='t-h'><xsl:value-of select="$bug-count-p1" />/<xsl:value-of select="$bug-count-p2" />/<xsl:value-of select="$bug-count-p3" />/<xsl:value-of select="$bug-count-p4" /></span>)
663         </a>
664      </div>
665      <div style="display:none;">
666         <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:attribute>
667         <xsl:variable name="cat-code-type">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:variable>
668         <xsl:variable name="bug-id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:variable>
669         <xsl:for-each select="/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and not(@last)]">
670            <xsl:call-template name="display-bug">
671               <xsl:with-param name="b-t"     select="@type" />
672               <xsl:with-param name="bug-id"       select="$bug-id" />
673               <xsl:with-param name="which-list"   select="'c'" />
674            </xsl:call-template>
675         </xsl:for-each>
676      </div>
677   </div>
678</xsl:template>
679
680<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
681<!-- main template for the list by package -->
682<xsl:template name="list-by-package" >
683   <div id='list-by-package' class='data-box' style='display:none;'>
684      <xsl:call-template name="helpPriorities" />
685      <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@total_bugs != '0']/@package">
686         <xsl:sort select="." order="ascending" />
687            <xsl:call-template name="packages">
688               <xsl:with-param name="package" select="." />
689            </xsl:call-template>
690      </xsl:for-each>
691   </div>
692</xsl:template>
693
694<xsl:template name="packages" >
695   <xsl:param name="package" select="''" />
696   <xsl:variable name="package-count-p1">
697      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != '')">0</xsl:if>
698      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != ''">
699         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1" />
700      </xsl:if>
701   </xsl:variable>
702   <xsl:variable name="package-count-p2">
703      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != '')">0</xsl:if>
704      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != ''">
705         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2" />
706      </xsl:if>
707   </xsl:variable>
708   <xsl:variable name="package-count-p3">
709      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != '')">0</xsl:if>
710      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != ''">
711         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3" />
712      </xsl:if>
713   </xsl:variable>
714   <xsl:variable name="package-count-p4">
715      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != '')">0</xsl:if>
716      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != ''">
717         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4" />
718      </xsl:if>
719   </xsl:variable>
720
721   <div class='ob'>
722      <div class='ob-t'>
723         <a>
724            <xsl:attribute name="href"></xsl:attribute>
725            <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />');return false;</xsl:attribute>
726            <xsl:value-of select="$package" />
727            (<xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@total_bugs" />:
728            <span class='t-h'><xsl:value-of select="$package-count-p1" />/<xsl:value-of select="$package-count-p2" />/<xsl:value-of select="$package-count-p3" />/<xsl:value-of select="$package-count-p4" /></span>)
729         </a>
730      </div>
731      <div style="display:none;">
732         <xsl:attribute name="id">package-<xsl:value-of select="$package" /></xsl:attribute>
733         <xsl:call-template name="list-by-package-and-class">
734            <xsl:with-param name="package" select="$package" />
735         </xsl:call-template>
736      </div>
737   </div>
738</xsl:template>
739
740<xsl:template name="list-by-package-and-class" >
741   <xsl:param name="package" select="''" />
742   <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@bugs != '0']/@class">
743      <xsl:sort select="." order="ascending" />
744         <xsl:call-template name="classes">
745            <xsl:with-param name="package" select="$package" />
746            <xsl:with-param name="class" select="." />
747         </xsl:call-template>
748   </xsl:for-each>
749</xsl:template>
750
751<xsl:template name="classes" >
752   <xsl:param name="package" select="''" />
753   <xsl:param name="class"     select="''" />
754   <xsl:variable name="class-count"
755                       select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@bugs" />
756
757   <xsl:variable name="class-count-p1">
758      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != '')">0</xsl:if>
759      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != ''">
760         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1" />
761      </xsl:if>
762   </xsl:variable>
763   <xsl:variable name="class-count-p2">
764      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != '')">0</xsl:if>
765      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != ''">
766         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2" />
767      </xsl:if>
768   </xsl:variable>
769   <xsl:variable name="class-count-p3">
770      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != '')">0</xsl:if>
771      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != ''">
772         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3" />
773      </xsl:if>
774   </xsl:variable>
775   <xsl:variable name="class-count-p4">
776      <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != '')">0</xsl:if>
777      <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != ''">
778         <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4" />
779      </xsl:if>
780   </xsl:variable>
781
782   <div class='ib-1'>
783      <div class="ib-1-t">
784         <a>
785            <xsl:attribute name="href"></xsl:attribute>
786            <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />');return false;</xsl:attribute>
787            <xsl:value-of select="$class" />  (<xsl:value-of select="$class-count" />:
788            <span class='t-h'><xsl:value-of select="$class-count-p1" />/<xsl:value-of select="$class-count-p2" />/<xsl:value-of select="$class-count-p3" />/<xsl:value-of select="$class-count-p4" /></span>)
789         </a>
790      </div>
791      <div style="display:none;">
792         <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" /></xsl:attribute>
793         <xsl:call-template name="list-by-package-and-class-and-bug">
794            <xsl:with-param name="package" select="$package" />
795            <xsl:with-param name="class" select="$class" />
796         </xsl:call-template>
797      </div>
798   </div>
799</xsl:template>
800
801<xsl:template name="list-by-package-and-class-and-bug" >
802   <xsl:param name="package" select="''" />
803   <xsl:param name="class" select="''" />
804   <xsl:variable name="unique-class-bugs" select="/BugCollection/BugInstance[not(@last) and Class[position()=1 and @classname=$class] and generate-id() = generate-id(key('lbp-class-b-t',concat(Class/@classname,@type)))]/@type" />
805
806   <xsl:for-each select="$unique-class-bugs">
807      <xsl:sort select="." order="ascending" />
808         <xsl:call-template name="class-bugs">
809            <xsl:with-param name="package" select="$package" />
810            <xsl:with-param name="class" select="$class" />
811            <xsl:with-param name="type" select="." />
812         </xsl:call-template>
813   </xsl:for-each>
814</xsl:template>
815
816<xsl:template name="class-bugs" >
817   <xsl:param name="package" select="''" />
818   <xsl:param name="class"     select="''" />
819   <xsl:param name="type"      select="''" />
820   <xsl:variable name="bug-count"
821                       select="count(/BugCollection/BugInstance[@type=$type and not(@last) and Class[position()=1 and @classname=$class]])" />
822   <div class='ib-2'>
823      <div class='ib-2-t'>
824         <a>
825            <xsl:attribute name="href"></xsl:attribute>
826            <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" />');return false;</xsl:attribute>
827            <xsl:attribute name="onmouseout">popUp(event,'tip-<xsl:value-of select="$type" />')</xsl:attribute>
828            <xsl:attribute name="onmouseover">popUp(event,'tip-<xsl:value-of select="$type" />')</xsl:attribute>
829            <xsl:value-of select="/BugCollection/BugPattern[@type=$type]/ShortDescription" /><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
830            (<xsl:value-of select="$bug-count" />)
831         </a>
832      </div>
833      <div style="display:none;">
834         <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:attribute>
835         <xsl:variable name="package-class-type">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:variable>
836         <xsl:variable name="bug-id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:variable>
837         <xsl:for-each select="/BugCollection/BugInstance[@type=$type and not(@last) and Class[position()=1 and @classname=$class]]">
838            <xsl:call-template name="display-bug">
839               <xsl:with-param name="b-t"     select="@type" />
840               <xsl:with-param name="bug-id"       select="$bug-id" />
841               <xsl:with-param name="which-list"   select="'p'" />
842            </xsl:call-template>
843         </xsl:for-each>
844      </div>
845   </div>
846</xsl:template>
847
848</xsl:transform>
849