Now using dependency injection for the XslTransformer instead of
[utils] / crawler / kiss / src / reportToHtml.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4     <xsl:template match="report">
5         <html>
6             <head>
7                 <title>KiSS crawler report</title>
8             </head>
9             <body>
10                 <h1>KiSS crawler report</h1>
11                 <xsl:apply-templates select="recorded"/>
12                 <xsl:if test="count(interesting) > 0">
13                     <h2>Possibly interesting programs</h2>
14                     <xsl:apply-templates select="interesting"/>
15                 </xsl:if>
16                 <xsl:if test="count(//program) = 0">
17                     <xsl:text>No suitable programs found </xsl:text>
18                 </xsl:if>
19             </body>
20         </html>
21
22     </xsl:template>
23
24     <xsl:template name="programTable">
25         <table align="left" cellpadding="5">
26             <!-- 
27             <tr align="left">
28                 <th align="left">Time</th>
29                 <th align="left">Channel</th>
30                 <th align="left">Program</th>
31             </tr>
32             -->
33             <xsl:apply-templates select="program"/>
34         </table>
35         <br clear="left"/>
36     </xsl:template>
37
38     <xsl:template match="recorded">
39         <h2>
40             <xsl:choose>
41                 <xsl:when test="@result = 'OK'">
42                     <xsl:text>Successfully recorded programs </xsl:text>
43                 </xsl:when>
44                 <xsl:when test="@result = 'DUPLICATE'">
45                     <xsl:text>Already recorded programs</xsl:text>
46                 </xsl:when>
47                 <xsl:when test="@result = 'CONFLICT'">
48                     <xsl:text>Conflicts with other recorded program</xsl:text>
49                 </xsl:when>
50                 <xsl:when test="@result='ERROR'">
51                     <xsl:text>Programs that could not be recorded for
52                     technical reasons.</xsl:text>
53                 </xsl:when>
54             </xsl:choose>
55         </h2>
56         <p>
57             <xsl:call-template name="programTable"/>
58         </p>
59     </xsl:template>
60
61     <xsl:template name="addProgramInfo">
62         <tr align="left">
63             <td><xsl:value-of select="interval/begin"/> - <xsl:value-of select="interval/end"/>: <strong>
64                     <xsl:value-of select="name"/>
65                 </strong> (<xsl:value-of select="channel"/>/<xsl:value-of select="keywords"/>)</td>
66
67         </tr>
68         <tr>
69             <td>
70                 <blockquote>
71                         <font size="-1">
72                             <xsl:value-of select="description"/>
73                         </font>
74                 </blockquote>
75             </td>
76
77
78         </tr>
79     </xsl:template>
80
81     <xsl:template match="program">
82         <xsl:call-template name="addProgramInfo"/>
83     </xsl:template>
84
85     <xsl:template match="interesting">
86         <xsl:call-template name="programTable"/>
87         <xsl:apply-templates select="category"/>
88     </xsl:template>
89
90     <xsl:template match="category">
91         <h3>Category: <xsl:value-of select="@name"/></h3>
92         <xsl:call-template name="programTable"/>
93     </xsl:template>
94 </xsl:stylesheet>
95