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