1*3d781bd6SAndre Fischer<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
2*3d781bd6SAndre Fischer
3*3d781bd6SAndre Fischer<!-- This style sheet converts any rat-report.xml file.  -->
4*3d781bd6SAndre Fischer
5*3d781bd6SAndre Fischer<xsl:variable name="now" select="current-dateTime()"/>
6*3d781bd6SAndre Fischer
7*3d781bd6SAndre Fischer<xsl:template match="/">
8*3d781bd6SAndre Fischer
9*3d781bd6SAndre Fischer    <html>
10*3d781bd6SAndre Fischer
11*3d781bd6SAndre Fischer    <xsl:comment>Generated at <xsl:value-of select="$now"/></xsl:comment>
12*3d781bd6SAndre Fischer    <head>
13*3d781bd6SAndre Fischer     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
14*3d781bd6SAndre Fischer     <style type="text/css">
15*3d781bd6SAndre Fischer    &lt;!--
16*3d781bd6SAndre Fischerbody {margin-top: 0px;font-size: 0.8em;background-color: #F9F7ED;}
17*3d781bd6SAndre Fischer
18*3d781bd6SAndre Fischerh1 {color:red;}
19*3d781bd6SAndre Fischerh2 {color:blue;}
20*3d781bd6SAndre Fischerh3 {color:green;}
21*3d781bd6SAndre Fischerh4 {color:orange;}
22*3d781bd6SAndre Fischer
23*3d781bd6SAndre Fischer/* Table Design */
24*3d781bd6SAndre Fischer
25*3d781bd6SAndre Fischertable,tr,td {text-align:center;font-weight:bold;border:1px solid #000;}
26*3d781bd6SAndre Fischercaption {color:blue;text-align:left;}
27*3d781bd6SAndre Fischer.notes, .binaries, .archives, .standards {width:25%;}
28*3d781bd6SAndre Fischer.notes {background:#D7EDEE;}
29*3d781bd6SAndre Fischer.binaries {background:#D0F2F4;}
30*3d781bd6SAndre Fischer.archives {background:#ABE7E9;}
31*3d781bd6SAndre Fischer.standards {background:#A0F0F4;}
32*3d781bd6SAndre Fischer.licenced, .generated {width:50%;}
33*3d781bd6SAndre Fischer.licenced {background:#C6EBDD;}
34*3d781bd6SAndre Fischer.generated {background:#ABE9D2;}
35*3d781bd6SAndre Fischer.java_note {background:#D6EBC6;}
36*3d781bd6SAndre Fischer.generated_note {background:#C9E7A9;}
37*3d781bd6SAndre Fischer.unknown {width:100%;background:#E92020;}
38*3d781bd6SAndre Fischer.unknown-zero {color:#00CC00;}
39*3d781bd6SAndre Fischer.center{text-align:center;margin:0 auto;}
40*3d781bd6SAndre Fischer--&gt;
41*3d781bd6SAndre Fischer     </style>
42*3d781bd6SAndre Fischer    </head>
43*3d781bd6SAndre Fischer    <body>
44*3d781bd6SAndre Fischer	    <xsl:apply-templates/>
45*3d781bd6SAndre Fischer	    <xsl:call-template name="generated"/>
46*3d781bd6SAndre Fischer    </body>
47*3d781bd6SAndre Fischer    </html>
48*3d781bd6SAndre Fischer</xsl:template>
49*3d781bd6SAndre Fischer
50*3d781bd6SAndre Fischer<xsl:template match="rat-report">
51*3d781bd6SAndre Fischer
52*3d781bd6SAndre Fischer	<h1>Rat Report</h1>
53*3d781bd6SAndre Fischer	<p>This HTML version (yes, it is!) is generated from the RAT xml reports using Saxon9B. All the outputs required are displayed below, similar to the .txt version.
54*3d781bd6SAndre Fischer           This is obviously a work in progress; and a prettier, easier to read and manage version will be available soon</p>
55*3d781bd6SAndre Fischer<div class="center">
56*3d781bd6SAndre Fischer<table id="rat-reports summary" cellspacing="0" summary="A snapshot summary of this rat report">
57*3d781bd6SAndre Fischer<caption>
58*3d781bd6SAndre FischerTable 1: A snapshot summary of this rat report.
59*3d781bd6SAndre Fischer</caption>
60*3d781bd6SAndre Fischer  <tr>
61*3d781bd6SAndre Fischer    <td colspan="1" class="notes">Notes: <xsl:value-of select="count(descendant::type[attribute::name=&quot;notice&quot;])"/></td>
62*3d781bd6SAndre Fischer    <td colspan="1" class="binaries">Binaries: <xsl:value-of select="count(descendant::type[attribute::name=&quot;binary&quot;])"/></td>
63*3d781bd6SAndre Fischer    <td colspan="1" class="archives">Archives: <xsl:value-of select="count(descendant::type[attribute::name=&quot;archive&quot;])"/></td>
64*3d781bd6SAndre Fischer    <td colspan="1" class="standards">Standards: <xsl:value-of select="count(descendant::type[attribute::name=&quot;standard&quot;])"/></td>
65*3d781bd6SAndre Fischer  </tr>
66*3d781bd6SAndre Fischer  <tr>
67*3d781bd6SAndre Fischer    <td colspan="2" class="licenced">Apache Licensed: <xsl:value-of select="count(descendant::header-type[attribute::name=&quot;AL   &quot;])"/></td>
68*3d781bd6SAndre Fischer    <td colspan="2" class="generated">Generated Documents: <xsl:value-of select="count(descendant::header-type[attribute::name=&quot;GEN  &quot;])"/></td>
69*3d781bd6SAndre Fischer  </tr>
70*3d781bd6SAndre Fischer  <tr>
71*3d781bd6SAndre Fischer    <td colspan="2" class="java_note">Note: JavaDocs are generated and so license header is optional</td>
72*3d781bd6SAndre Fischer    <td colspan="2" class="generated_note">Note: Generated files do not require license headers</td>
73*3d781bd6SAndre Fischer  </tr>
74*3d781bd6SAndre Fischer  <tr>
75*3d781bd6SAndre Fischer<xsl:choose>
76*3d781bd6SAndre Fischer  <xsl:when test="count(descendant::header-type[attribute::name=&quot;?????&quot;]) &gt; 0">
77*3d781bd6SAndre Fischer    <td colspan="4" class="unknown"><xsl:value-of select="count(descendant::header-type[attribute::name=&quot;?????&quot;])"/> Unknown Licenses - or files without a license.</td>
78*3d781bd6SAndre Fischer  </xsl:when>
79*3d781bd6SAndre Fischer  <xsl:otherwise>
80*3d781bd6SAndre Fischer    <td colspan="4" class="unknown-zero"><xsl:value-of select="count(descendant::header-type[attribute::name=&quot;?????&quot;])"/> Unknown Licenses - or files without a license.</td>
81*3d781bd6SAndre Fischer  </xsl:otherwise>
82*3d781bd6SAndre Fischer</xsl:choose>
83*3d781bd6SAndre Fischer  </tr>
84*3d781bd6SAndre Fischer</table>
85*3d781bd6SAndre Fischer</div>
86*3d781bd6SAndre Fischer<hr/>
87*3d781bd6SAndre Fischer	<h3>Unapproved Licenses:</h3>
88*3d781bd6SAndre Fischer
89*3d781bd6SAndre Fischer	<xsl:for-each select="descendant::resource[license-approval/@name=&quot;false&quot;]">
90*3d781bd6SAndre Fischer  <xsl:text>  </xsl:text>
91*3d781bd6SAndre Fischer  <xsl:value-of select="@name"/><br/>
92*3d781bd6SAndre Fischer  <xsl:text>
93*3d781bd6SAndre Fischer</xsl:text>
94*3d781bd6SAndre Fischer</xsl:for-each>
95*3d781bd6SAndre Fischer<hr/>
96*3d781bd6SAndre Fischer
97*3d781bd6SAndre Fischer<h3>Archives:</h3>
98*3d781bd6SAndre Fischer
99*3d781bd6SAndre Fischer<xsl:for-each select="descendant::resource[type/@name=&quot;archive&quot;]">
100*3d781bd6SAndre Fischer + <xsl:value-of select="@name"/>
101*3d781bd6SAndre Fischer <br/>
102*3d781bd6SAndre Fischer </xsl:for-each>
103*3d781bd6SAndre Fischer <hr/>
104*3d781bd6SAndre Fischer
105*3d781bd6SAndre Fischer <p>
106*3d781bd6SAndre Fischer	 Files with Apache License headers will be marked AL<br/>
107*3d781bd6SAndre Fischer	 Binary files (which do not require AL headers) will be marked B<br/>
108*3d781bd6SAndre Fischer  Compressed archives will be marked A<br/>
109*3d781bd6SAndre Fischer  Notices, licenses etc will be marked N<br/>
110*3d781bd6SAndre Fischer  </p>
111*3d781bd6SAndre Fischer
112*3d781bd6SAndre Fischer <xsl:for-each select="descendant::resource">
113*3d781bd6SAndre Fischer  <xsl:choose>
114*3d781bd6SAndre Fischer	 <xsl:when test="license-approval/@name=&quot;false&quot;">!</xsl:when>
115*3d781bd6SAndre Fischer	 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
116*3d781bd6SAndre Fischer </xsl:choose>
117*3d781bd6SAndre Fischer <xsl:choose>
118*3d781bd6SAndre Fischer	 <xsl:when test="type/@name=&quot;notice&quot;">N   </xsl:when>
119*3d781bd6SAndre Fischer	 <xsl:when test="type/@name=&quot;archive&quot;">A   </xsl:when>
120*3d781bd6SAndre Fischer	 <xsl:when test="type/@name=&quot;binary&quot;">B   </xsl:when>
121*3d781bd6SAndre Fischer	 <xsl:when test="type/@name=&quot;standard&quot;"><xsl:value-of select="header-type/@name"/></xsl:when>
122*3d781bd6SAndre Fischer	 <xsl:otherwise>!!!!!</xsl:otherwise>
123*3d781bd6SAndre Fischer </xsl:choose>
124*3d781bd6SAndre Fischer <xsl:text>      </xsl:text>
125*3d781bd6SAndre Fischer <xsl:value-of select="@name"/><br/>
126*3d781bd6SAndre Fischer <xsl:text>
127*3d781bd6SAndre Fischer </xsl:text>
128*3d781bd6SAndre Fischer </xsl:for-each>
129*3d781bd6SAndre Fischer <hr/>
130*3d781bd6SAndre Fischer
131*3d781bd6SAndre Fischer <h3>Printing headers for files without AL header...</h3>
132*3d781bd6SAndre Fischer
133*3d781bd6SAndre Fischer <xsl:for-each select="descendant::resource[header-type/@name=&quot;?????&quot;]">
134*3d781bd6SAndre Fischer
135*3d781bd6SAndre Fischer	 <h4><xsl:value-of select="@name"/></h4>
136*3d781bd6SAndre Fischer  <xsl:value-of select="header-sample"/>
137*3d781bd6SAndre Fischer  <hr/>
138*3d781bd6SAndre Fischer</xsl:for-each>
139*3d781bd6SAndre Fischer<br/>
140*3d781bd6SAndre Fischer
141*3d781bd6SAndre Fischer <!-- <xsl:apply-templates select="resource"/>
142*3d781bd6SAndre Fischer    <xsl:apply-templates select="header-sample"/>
143*3d781bd6SAndre Fischer    <xsl:apply-templates select="header-type"/>
144*3d781bd6SAndre Fischer    <xsl:apply-templates select="license-family"/>
145*3d781bd6SAndre Fischer    <xsl:apply-templates select="license-approval"/>
146*3d781bd6SAndre Fischer    <xsl:apply-templates select="type"/> -->
147*3d781bd6SAndre Fischer
148*3d781bd6SAndre Fischer</xsl:template>
149*3d781bd6SAndre Fischer
150*3d781bd6SAndre Fischer<xsl:template match="resource">
151*3d781bd6SAndre Fischer	<div>
152*3d781bd6SAndre Fischer		<h3>Resource: <xsl:value-of select="@name"/></h3>
153*3d781bd6SAndre Fischer      <xsl:apply-templates/>
154*3d781bd6SAndre Fischer    </div>
155*3d781bd6SAndre Fischer</xsl:template>
156*3d781bd6SAndre Fischer
157*3d781bd6SAndre Fischer<xsl:template match="header-sample">
158*3d781bd6SAndre Fischer	<xsl:if test="normalize-space(.) != ''">
159*3d781bd6SAndre Fischer  <h4>First few lines of non-compliant file</h4>
160*3d781bd6SAndre Fischer    <p>
161*3d781bd6SAndre Fischer      <xsl:value-of select="."/>
162*3d781bd6SAndre Fischer    </p>
163*3d781bd6SAndre Fischer    </xsl:if>
164*3d781bd6SAndre Fischer    <h4>Other Info:</h4>
165*3d781bd6SAndre Fischer</xsl:template>
166*3d781bd6SAndre Fischer
167*3d781bd6SAndre Fischer<xsl:template match="header-type">
168*3d781bd6SAndre Fischer	Header Type: <xsl:value-of select="@name"/>
169*3d781bd6SAndre Fischer	<br/>
170*3d781bd6SAndre Fischer</xsl:template>
171*3d781bd6SAndre Fischer
172*3d781bd6SAndre Fischer<xsl:template match="license-family">
173*3d781bd6SAndre Fischer	License Family: <xsl:value-of select="@name"/>
174*3d781bd6SAndre Fischer	<br/>
175*3d781bd6SAndre Fischer</xsl:template>
176*3d781bd6SAndre Fischer
177*3d781bd6SAndre Fischer<xsl:template match="license-approval">
178*3d781bd6SAndre Fischer	License Approval: <xsl:value-of select="@name"/>
179*3d781bd6SAndre Fischer	<br/>
180*3d781bd6SAndre Fischer</xsl:template>
181*3d781bd6SAndre Fischer
182*3d781bd6SAndre Fischer<xsl:template match="type">
183*3d781bd6SAndre Fischer	Type: <xsl:value-of select="@name"/>
184*3d781bd6SAndre Fischer	<br/>
185*3d781bd6SAndre Fischer</xsl:template>
186*3d781bd6SAndre Fischer
187*3d781bd6SAndre Fischer<xsl:template name="generated">
188*3d781bd6SAndre Fischer	<p>Generated at <xsl:value-of select="$now"/></p>
189*3d781bd6SAndre Fischer</xsl:template>
190*3d781bd6SAndre Fischer</xsl:transform>