source: Dev/branches/play-2.0.1/repository/cache/ivy-report.xsl @ 322

Last change on this file since 322 was 322, checked in by hendrikvanantwerpen, 13 years ago

Added Play! framework and application with Jena dependency. Working on
the basic things now (login/register), after that start implementing
our data model.

File size: 21.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!--
3   Licensed to the Apache Software Foundation (ASF) under one
4   or more contributor license agreements.  See the NOTICE file
5   distributed with this work for additional information
6   regarding copyright ownership.  The ASF licenses this file
7   to you under the Apache License, Version 2.0 (the
8   "License"); you may not use this file except in compliance
9   with the License.  You may obtain a copy of the License at
10
11     http://www.apache.org/licenses/LICENSE-2.0
12
13   Unless required by applicable law or agreed to in writing,
14   software distributed under the License is distributed on an
15   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   KIND, either express or implied.  See the License for the
17   specific language governing permissions and limitations
18   under the License.   
19-->
20<xsl:stylesheet version="1.0"
21  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
22
23<xsl:param name="confs"    select="/ivy-report/info/@confs"/>
24<xsl:param name="extension"    select="'xml'"/>
25
26<xsl:variable name="myorg"    select="/ivy-report/info/@organisation"/>
27<xsl:variable name="mymod"    select="/ivy-report/info/@module"/>
28<xsl:variable name="myconf"   select="/ivy-report/info/@conf"/>
29
30<xsl:variable name="modules"    select="/ivy-report/dependencies/module"/>
31<xsl:variable name="conflicts" select="$modules[count(revision) > 1]"/>
32
33<xsl:variable name="revisions"  select="$modules/revision"/>
34<xsl:variable name="evicteds"   select="$revisions[@evicted]"/>
35<xsl:variable name="downloadeds"   select="$revisions[@downloaded='true']"/>
36<xsl:variable name="searcheds"   select="$revisions[@searched='true']"/>
37<xsl:variable name="errors"   select="$revisions[@error]"/>
38
39<xsl:variable name="artifacts"   select="$revisions/artifacts/artifact"/>
40<xsl:variable name="cacheartifacts" select="$artifacts[@status='no']"/>
41<xsl:variable name="dlartifacts" select="$artifacts[@status='successful']"/>
42<xsl:variable name="faileds" select="$artifacts[@status='failed']"/>
43<xsl:variable name="artifactsok" select="$artifacts[@status!='failed']"/>
44
45<xsl:template name="calling">
46    <xsl:param name="org" />
47    <xsl:param name="mod" />
48    <xsl:param name="rev" />
49    <xsl:if test="count($modules/revision/caller[(@organisation=$org and @name=$mod) and @callerrev=$rev]) = 0">
50    <table><tr><td>
51    No dependency
52    </td></tr></table>
53    </xsl:if>
54    <xsl:if test="count($modules/revision/caller[(@organisation=$org and @name=$mod) and @callerrev=$rev]) > 0">
55    <table class="deps">
56      <thead>
57      <tr>
58        <th>Module</th>
59        <th>Revision</th>
60        <th>Status</th>
61        <th>Resolver</th>
62        <th>Default</th>
63        <th>Licenses</th>
64        <th>Size</th>
65        <th></th>
66      </tr>
67      </thead>
68      <tbody>
69        <xsl:for-each select="$modules/revision/caller[(@organisation=$org and @name=$mod) and @callerrev=$rev]">
70          <xsl:call-template name="called">
71            <xsl:with-param name="callstack"     select="concat($org, string('/'), $mod)"/>
72            <xsl:with-param name="indent"        select="string('')"/>
73            <xsl:with-param name="revision"      select=".."/>
74          </xsl:call-template>
75        </xsl:for-each>   
76      </tbody>
77    </table>
78    </xsl:if>
79</xsl:template>
80
81<xsl:template name="called">
82    <xsl:param name="callstack"/>
83    <xsl:param name="indent"/>
84    <xsl:param name="revision"/>
85
86    <xsl:param name="organisation" select="$revision/../@organisation"/>
87    <xsl:param name="module" select="$revision/../@name"/>
88    <xsl:param name="rev" select="$revision/@name"/>
89    <xsl:param name="resolver" select="$revision/@resolver"/>
90    <xsl:param name="isdefault" select="$revision/@default"/>
91    <xsl:param name="status" select="$revision/@status"/>
92    <tr>
93    <td>
94       <xsl:element name="a">
95         <xsl:attribute name="href">#<xsl:value-of select="$organisation"/>-<xsl:value-of select="$module"/></xsl:attribute>
96         <xsl:value-of select="concat($indent, ' ')"/>
97         <xsl:value-of select="$module"/>
98         by
99         <xsl:value-of select="$organisation"/>
100       </xsl:element>
101    </td>
102    <td>
103       <xsl:element name="a">
104         <xsl:attribute name="href">#<xsl:value-of select="$organisation"/>-<xsl:value-of select="$module"/>-<xsl:value-of select="$rev"/></xsl:attribute>
105         <xsl:value-of select="$rev"/>
106       </xsl:element>
107    </td>
108    <td align="center">
109         <xsl:value-of select="$status"/>
110    </td>
111    <td align="center">
112         <xsl:value-of select="$resolver"/>
113    </td>
114    <td align="center">
115         <xsl:value-of select="$isdefault"/>
116    </td>
117    <td align="center">
118      <xsl:call-template name="licenses">
119        <xsl:with-param name="revision"      select="$revision"/>
120      </xsl:call-template>
121    </td>
122    <td align="center">
123      <xsl:value-of select="round(sum($revision/artifacts/artifact/@size) div 1024)"/> kB
124    </td>
125    <td align="center">
126          <xsl:call-template name="icons">
127            <xsl:with-param name="revision"      select="$revision"/>
128          </xsl:call-template>
129    </td>
130    </tr>
131    <xsl:if test="not($revision/@evicted)">
132    <xsl:if test="not(contains($callstack, concat($organisation, string('/'), $module)))">
133    <xsl:for-each select="$modules/revision/caller[(@organisation=$organisation and @name=$module) and @callerrev=$rev]">
134          <xsl:call-template name="called">
135            <xsl:with-param name="callstack"     select="concat($callstack, string('#'), $organisation, string('/'), $module)"/>
136            <xsl:with-param name="indent"        select="concat($indent, string('---'))"/>
137            <xsl:with-param name="revision"      select=".."/>
138          </xsl:call-template>
139    </xsl:for-each>   
140    </xsl:if>
141    </xsl:if>
142</xsl:template>
143
144<xsl:template name="licenses">
145      <xsl:param name="revision"/>
146      <xsl:for-each select="$revision/license">
147        <span style="padding-right:3px;">
148        <xsl:if test="@url">
149                <xsl:element name="a">
150                    <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
151                        <xsl:value-of select="@name"/>
152                </xsl:element>
153        </xsl:if>
154        <xsl:if test="not(@url)">
155                        <xsl:value-of select="@name"/>
156        </xsl:if>
157        </span>
158      </xsl:for-each>
159</xsl:template>
160
161<xsl:template name="icons">
162    <xsl:param name="revision"/>
163    <xsl:if test="$revision/@searched = 'true'">
164         <img src="http://ant.apache.org/ivy/images/searched.gif" alt="searched" title="required a search in repository"/>
165    </xsl:if>
166    <xsl:if test="$revision/@downloaded = 'true'">
167         <img src="http://ant.apache.org/ivy/images/downloaded.gif" alt="downloaded" title="downloaded from repository"/>
168    </xsl:if>
169    <xsl:if test="$revision/@evicted">
170        <xsl:element name="img">
171            <xsl:attribute name="src">http://ant.apache.org/ivy/images/evicted.gif</xsl:attribute>
172            <xsl:attribute name="alt">evicted</xsl:attribute>
173            <xsl:attribute name="title">evicted by <xsl:for-each select="$revision/evicted-by"><xsl:value-of select="@rev"/> </xsl:for-each></xsl:attribute>
174        </xsl:element>
175    </xsl:if>
176    <xsl:if test="$revision/@error">
177        <xsl:element name="img">
178            <xsl:attribute name="src">http://ant.apache.org/ivy/images/error.gif</xsl:attribute>
179            <xsl:attribute name="alt">error</xsl:attribute>
180            <xsl:attribute name="title">error: <xsl:value-of select="$revision/@error"/></xsl:attribute>
181        </xsl:element>
182    </xsl:if>
183</xsl:template>
184
185<xsl:template name="error">
186    <xsl:param name="organisation"/>
187    <xsl:param name="module"/>
188    <xsl:param name="revision"/>
189    <xsl:param name="error"/>
190    <tr>
191    <td>
192       <xsl:element name="a">
193         <xsl:attribute name="href">#<xsl:value-of select="$organisation"/>-<xsl:value-of select="$module"/></xsl:attribute>
194         <xsl:value-of select="$module"/>
195         by
196         <xsl:value-of select="$organisation"/>
197       </xsl:element>
198    </td>
199    <td>
200       <xsl:element name="a">
201         <xsl:attribute name="href">#<xsl:value-of select="$organisation"/>-<xsl:value-of select="$module"/>-<xsl:value-of select="$revision"/></xsl:attribute>
202         <xsl:value-of select="$revision"/>
203       </xsl:element>
204    </td>
205    <td>
206         <xsl:value-of select="$error"/>
207    </td>
208    </tr>
209</xsl:template>
210
211<xsl:template name="confs">
212    <xsl:param name="configurations"/>
213   
214    <xsl:if test="contains($configurations, ',')">
215      <xsl:call-template name="conf">
216        <xsl:with-param name="conf" select="normalize-space(substring-before($configurations,','))"/>
217      </xsl:call-template>
218      <xsl:call-template name="confs">
219        <xsl:with-param name="configurations" select="substring-after($configurations,',')"/>
220      </xsl:call-template>
221    </xsl:if>
222    <xsl:if test="not(contains($configurations, ','))">
223      <xsl:call-template name="conf">
224        <xsl:with-param name="conf" select="normalize-space($configurations)"/>
225      </xsl:call-template>
226    </xsl:if>
227</xsl:template>
228
229<xsl:template name="conf">
230    <xsl:param name="conf"/>
231   
232     <li>
233       <xsl:element name="a">
234         <xsl:if test="$conf = $myconf">
235           <xsl:attribute name="class">active</xsl:attribute>
236         </xsl:if>
237         <xsl:attribute name="href"><xsl:value-of select="$myorg"/>-<xsl:value-of select="$mymod"/>-<xsl:value-of select="$conf"/>.<xsl:value-of select="$extension"/></xsl:attribute>
238         <xsl:value-of select="$conf"/>
239       </xsl:element>
240     </li>
241</xsl:template>
242
243<xsl:template name="date">
244    <xsl:param name="date"/>
245   
246    <xsl:value-of select="substring($date,1,4)"/>-<xsl:value-of select="substring($date,5,2)"/>-<xsl:value-of select="substring($date,7,2)"/>
247    <xsl:value-of select="' '"/>
248    <xsl:value-of select="substring($date,9,2)"/>:<xsl:value-of select="substring($date,11,2)"/>:<xsl:value-of select="substring($date,13)"/>
249</xsl:template>
250
251
252<xsl:template match="/ivy-report">
253
254  <html>
255  <head>
256    <title>Ivy report :: <xsl:value-of select="info/@module"/> by <xsl:value-of select="info/@organisation"/> :: <xsl:value-of select="info/@conf"/></title>
257    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
258    <meta http-equiv="content-language" content="en" />
259    <meta name="robots" content="index,follow" />
260    <link rel="stylesheet" type="text/css" href="ivy-report.css" />
261  </head>
262  <body>
263    <div id="logo"><a href="http://ant.apache.org/ivy/"><img src="http://ant.apache.org/ivy/images/logo.png"/></a></div>
264    <h1>
265      <xsl:element name="a">
266        <xsl:attribute name="name"><xsl:value-of select="info/@organisation"/>-<xsl:value-of select="info/@module"/></xsl:attribute>
267      </xsl:element>
268        <span id="module">
269                <xsl:value-of select="concat(info/@module, ' ', info/@revision)"/>
270        </span>
271        by
272        <span id="organisation">
273                <xsl:value-of select="info/@organisation"/>
274        </span>
275    </h1>
276    <div id="date">
277    resolved on
278      <xsl:call-template name="date">
279        <xsl:with-param name="date" select="info/@date"/>
280      </xsl:call-template>
281    </div>
282    <ul id="confmenu">
283      <xsl:call-template name="confs">
284        <xsl:with-param name="configurations" select="$confs"/>
285      </xsl:call-template>
286    </ul>
287
288    <div id="content">
289    <h2>Dependencies Stats</h2>
290        <table class="header">
291          <tr><td class="title">Modules</td><td class="value"><xsl:value-of select="count($modules)"/></td></tr>
292          <tr><td class="title">Revisions</td><td class="value"><xsl:value-of select="count($revisions)"/> 
293            (<xsl:value-of select="count($searcheds)"/> searched <img src="http://ant.apache.org/ivy/images/searched.gif" alt="searched" title="module revisions which required a search with a dependency resolver to be resolved"/>,
294            <xsl:value-of select="count($downloadeds)"/> downloaded <img src="http://ant.apache.org/ivy/images/downloaded.gif" alt="downloaded" title="module revisions for which ivy file was downloaded by dependency resolver"/>,
295            <xsl:value-of select="count($evicteds)"/> evicted <img src="http://ant.apache.org/ivy/images/evicted.gif" alt="evicted" title="module revisions which were evicted by others"/>,
296            <xsl:value-of select="count($errors)"/> errors <img src="http://ant.apache.org/ivy/images/error.gif" alt="error" title="module revisions on which error occurred"/>)</td></tr>
297          <tr><td class="title">Artifacts</td><td class="value"><xsl:value-of select="count($artifacts)"/>
298            (<xsl:value-of select="count($dlartifacts)"/> downloaded,
299            <xsl:value-of select="count($faileds)"/> failed)</td></tr>
300          <tr><td class="title">Artifacts size</td><td class="value"><xsl:value-of select="round(sum($artifacts/@size) div 1024)"/> kB
301            (<xsl:value-of select="round(sum($dlartifacts/@size) div 1024)"/> kB downloaded,
302            <xsl:value-of select="round(sum($cacheartifacts/@size) div 1024)"/> kB in cache)</td></tr>
303        </table>
304   
305    <xsl:if test="count($errors) > 0">
306    <h2>Errors</h2>
307    <table class="errors">
308      <thead>
309      <tr>
310        <th>Module</th>
311        <th>Revision</th>
312        <th>Error</th>
313      </tr>
314      </thead>
315      <tbody>
316      <xsl:for-each select="$errors">
317          <xsl:call-template name="error">
318            <xsl:with-param name="organisation"  select="../@organisation"/>
319            <xsl:with-param name="module"        select="../@name"/>
320            <xsl:with-param name="revision"      select="@name"/>
321            <xsl:with-param name="error"        select="@error"/>
322          </xsl:call-template>
323      </xsl:for-each>
324      </tbody>
325      </table>
326    </xsl:if>
327
328    <xsl:if test="count($conflicts) > 0">
329    <h2>Conflicts</h2>
330    <table class="conflicts">
331      <thead>
332      <tr>
333        <th>Module</th>
334        <th>Selected</th>
335        <th>Evicted</th>
336      </tr>
337      </thead>
338      <tbody>
339      <xsl:for-each select="$conflicts">
340        <tr>
341        <td>
342           <xsl:element name="a">
343             <xsl:attribute name="href">#<xsl:value-of select="@organisation"/>-<xsl:value-of select="@name"/></xsl:attribute>
344             <xsl:value-of select="@name"/>
345             by
346             <xsl:value-of select="@organisation"/>
347           </xsl:element>
348        </td>
349        <td>
350          <xsl:for-each select="revision[not(@evicted)]">
351             <xsl:element name="a">
352               <xsl:attribute name="href">#<xsl:value-of select="../@organisation"/>-<xsl:value-of select="../@name"/>-<xsl:value-of select="@name"/></xsl:attribute>
353               <xsl:value-of select="@name"/>
354             </xsl:element>
355             <xsl:text> </xsl:text>
356          </xsl:for-each>
357        </td>
358        <td>
359          <xsl:for-each select="revision[@evicted]">
360             <xsl:element name="a">
361               <xsl:attribute name="href">#<xsl:value-of select="../@organisation"/>-<xsl:value-of select="../@name"/>-<xsl:value-of select="@name"/></xsl:attribute>
362               <xsl:value-of select="@name"/>
363                           <xsl:text> </xsl:text>
364               <xsl:value-of select="@evicted-reason"/>
365             </xsl:element>
366             <xsl:text> </xsl:text>
367          </xsl:for-each>
368        </td>
369        </tr>
370      </xsl:for-each>
371      </tbody>
372      </table>
373    </xsl:if>
374
375    <h2>Dependencies Overview</h2>
376        <xsl:call-template name="calling">
377          <xsl:with-param name="org" select="info/@organisation"/>
378          <xsl:with-param name="mod" select="info/@module"/>
379          <xsl:with-param name="rev" select="info/@revision"/>
380        </xsl:call-template>
381
382    <h2>Details</h2>   
383    <xsl:for-each select="$modules">
384    <h3>
385      <xsl:element name="a">
386         <xsl:attribute name="name"><xsl:value-of select="@organisation"/>-<xsl:value-of select="@name"/></xsl:attribute>
387      </xsl:element>
388      <xsl:value-of select="@name"/> by <xsl:value-of select="@organisation"/>
389    </h3>   
390      <xsl:for-each select="revision">
391        <h4>
392          <xsl:element name="a">
393             <xsl:attribute name="name"><xsl:value-of select="../@organisation"/>-<xsl:value-of select="../@name"/>-<xsl:value-of select="@name"/></xsl:attribute>
394          </xsl:element>
395           Revision: <xsl:value-of select="@name"/>
396          <span style="padding-left:15px;">
397          <xsl:call-template name="icons">
398            <xsl:with-param name="revision"      select="."/>
399          </xsl:call-template>
400          </span>
401        </h4>
402        <table class="header">
403                <xsl:if test="@homepage">
404            <tr><td class="title">Home Page</td><td class="value">
405              <xsl:element name="a">
406                    <xsl:attribute name="href"><xsl:value-of select="@homepage"/></xsl:attribute>
407                        <xsl:value-of select="@homepage"/>
408                </xsl:element></td>
409            </tr>               
410                </xsl:if>
411          <tr><td class="title">Status</td><td class="value"><xsl:value-of select="@status"/></td></tr>
412          <tr><td class="title">Publication</td><td class="value"><xsl:value-of select="@pubdate"/></td></tr>
413          <tr><td class="title">Resolver</td><td class="value"><xsl:value-of select="@resolver"/></td></tr>
414          <tr><td class="title">Configurations</td><td class="value"><xsl:value-of select="@conf"/></td></tr>
415          <tr><td class="title">Artifacts size</td><td class="value"><xsl:value-of select="round(sum(artifacts/artifact/@size) div 1024)"/> kB
416            (<xsl:value-of select="round(sum(artifacts/artifact[@status='successful']/@size) div 1024)"/> kB downloaded,
417            <xsl:value-of select="round(sum(artifacts/artifact[@status='no']/@size) div 1024)"/> kB in cache)</td></tr>
418                <xsl:if test="count(license) > 0">
419            <tr><td class="title">Licenses</td><td class="value">
420                              <xsl:call-template name="licenses">
421                                <xsl:with-param name="revision"      select="."/>
422                              </xsl:call-template>
423            </td></tr>                 
424                </xsl:if>
425        <xsl:if test="@evicted">
426        <tr><td class="title">Evicted by</td><td class="value"> 
427            <b>
428                        <xsl:for-each select="evicted-by">
429              <xsl:value-of select="@rev"/>
430                          <xsl:text> </xsl:text>
431            </xsl:for-each>
432                        </b>
433                        <xsl:text> </xsl:text>
434             <b><xsl:value-of select="@evicted-reason"/></b>
435                         in <b><xsl:value-of select="@evicted"/></b> conflict manager
436        </td></tr>
437        </xsl:if>
438        </table>
439        <h5>Required by</h5>
440        <table>
441          <thead>
442          <tr>
443            <th>Organisation</th>
444            <th>Name</th>
445            <th>Revision</th>
446            <th>In Configurations</th>
447            <th>Asked Revision</th>
448          </tr>
449          </thead>
450          <tbody>
451            <xsl:for-each select="caller">
452              <tr>
453              <td><xsl:value-of select="@organisation"/></td>
454              <td>
455                 <xsl:element name="a">
456                         <xsl:attribute name="href">#<xsl:value-of select="@organisation"/>-<xsl:value-of select="@name"/></xsl:attribute>
457                                 <xsl:value-of select="@name"/>
458                       </xsl:element>
459              </td>
460              <td><xsl:value-of select="@callerrev"/></td>
461              <td><xsl:value-of select="@conf"/></td>
462              <td><xsl:value-of select="@rev"/></td>
463              </tr>
464            </xsl:for-each>   
465          </tbody>
466        </table>
467        <xsl:if test="not(@evicted)">
468       
469        <h5>Dependencies</h5>
470        <xsl:call-template name="calling">
471          <xsl:with-param name="org" select="../@organisation"/>
472          <xsl:with-param name="mod" select="../@name"/>
473          <xsl:with-param name="rev" select="@name"/>
474        </xsl:call-template>
475        <h5>Artifacts</h5>
476        <xsl:if test="count(artifacts/artifact) = 0">
477        <table><tr><td>
478        No artifact
479        </td></tr></table>
480        </xsl:if>
481        <xsl:if test="count(artifacts/artifact) > 0">
482        <table>
483          <thead>
484          <tr>
485            <th>Name</th>
486            <th>Type</th>
487            <th>Ext</th>
488            <th>Download</th>
489            <th>Size</th>
490          </tr>
491          </thead>
492          <tbody>
493            <xsl:for-each select="artifacts/artifact">
494              <tr>
495              <td><xsl:value-of select="@name"/></td>
496              <td><xsl:value-of select="@type"/></td>
497              <td><xsl:value-of select="@ext"/></td>
498              <td align="center"><xsl:value-of select="@status"/></td>
499              <td align="center"><xsl:value-of select="round(number(@size) div 1024)"/> kB</td>
500              </tr>
501            </xsl:for-each>   
502          </tbody>
503        </table>
504        </xsl:if>
505       
506        </xsl:if>
507      </xsl:for-each>   
508    </xsl:for-each>
509    </div>
510  </body>
511  </html>
512</xsl:template>
513
514</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.