(no commit message)
[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                 <xsl:apply-templates select="messages"/>
20             </body>
21         </html>
22
23     </xsl:template>
24
25     <xsl:template name="programTable">
26         <p>
27         <table align="left" cellpadding="5">
28             <!-- 
29             <tr align="left">
30                 <th align="left">Time</th>
31                 <th align="left">Channel</th>
32                 <th align="left">Program</th>
33             </tr>
34             -->
35             <xsl:apply-templates select="program"/>
36         </table>
37         <br clear="left"/>
38         </p>
39     </xsl:template>
40
41     <xsl:template match="recorded">
42         <h2>
43             <xsl:choose>
44                 <xsl:when test="@result = 'OK'">
45                     <xsl:text>Successfully recorded programs </xsl:text>
46                     <xsl:call-template name="programTable"/>
47                 </xsl:when>
48                 <xsl:when test="@result = 'DUPLICATE'">
49                     <xsl:text>Already recorded programs</xsl:text>
50                     <xsl:call-template name="programTable"/>
51                 </xsl:when>
52                 <xsl:when test="@result = 'CONFLICT'">
53                     <xsl:text>Conflicts with other recorded programs</xsl:text>
54                     <xsl:call-template name="programTable"/>
55                 </xsl:when>
56                 <xsl:when test="@result='ERROR'">
57                     <xsl:text>Programs that could not be recorded for
58                     technical reasons.</xsl:text>
59                     <xsl:call-template name="programTable"/>
60                 </xsl:when>
61             </xsl:choose>
62         </h2>
63     </xsl:template>
64
65     <xsl:template name="addProgramInfo">
66         <tr align="left">
67             <td><xsl:value-of select="interval/begin"/> - <xsl:value-of select="interval/end"/>: <strong>
68                     <xsl:value-of select="name"/>
69                 </strong> (<xsl:value-of select="channel"/>/<xsl:value-of select="keywords"/>)</td>
70
71         </tr>
72         <tr>
73             <td>
74                 <blockquote>
75                         <font size="-1">
76                             <xsl:value-of select="description"/>
77                         </font>
78                 </blockquote>
79             </td>
80
81
82         </tr>
83     </xsl:template>
84
85     <xsl:template match="program">
86         <xsl:call-template name="addProgramInfo"/>
87     </xsl:template>
88
89     <xsl:template match="interesting">
90         <xsl:call-template name="programTable"/>
91         <xsl:apply-templates select="category"/>
92     </xsl:template>
93
94     <xsl:template match="category">
95         <h3>Category: <xsl:value-of select="@name"/></h3>
96         <xsl:call-template name="programTable"/>
97     </xsl:template>
98     
99     <xsl:template match="messages">
100         <h2>Messages</h2>
101         <ul>
102         <xsl:for-each select="message">
103             <li><font size="-1">
104               <xsl:value-of select="."/>
105                 </font>
106             </li>
107         </xsl:for-each>
108         </ul>
109     </xsl:template>
110 </xsl:stylesheet>
111