(no commit message)
[utils] / crawler / kiss / src / reportToText.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   <xsl:output method="text"/>
4   
5   <xsl:include href="utilities.xsl"/>
6   <xsl:template match="report">
7     <xsl:text>KiSS crawler report</xsl:text>
8     <xsl:value-of select="$newline"/>
9     <xsl:value-of select="$newline"/>
10     
11     <xsl:apply-templates select="recorded"/>
12     <xsl:if test="count(interesting) > 0">
13       <xsl:text>Possibly interesting programs</xsl:text>
14       <xsl:value-of select="$newline"/>
15       <xsl:value-of select="$newline"/>
16       
17       <xsl:apply-templates select="interesting"/>
18     </xsl:if>
19   </xsl:template>
20   
21   <xsl:template name="programTable">
22     <xsl:apply-templates select="program"/>
23   </xsl:template>
24   <xsl:template match="recorded">
25     <xsl:choose>
26       <xsl:when test="@result = 'OK'">
27         <xsl:text>Successfully recorded programs </xsl:text>
28         <xsl:value-of select="$newline"/>
29         <xsl:value-of select="$newline"/>
30       </xsl:when>
31       <xsl:when test="@result = 'DUPLICATE'">
32         <xsl:text>Already recorded programs</xsl:text>
33         <xsl:value-of select="$newline"/>
34         <xsl:value-of select="$newline"/>
35       </xsl:when>
36       <xsl:when test="@result = 'CONFLICT'">
37         <xsl:text>Conflicts with other recorded programs</xsl:text>
38         <xsl:value-of select="$newline"/>
39         <xsl:value-of select="$newline"/>
40       </xsl:when>
41       <xsl:when test="@result='ERROR'">
42         <xsl:text>Programs that could not be recorded for technical reasons.</xsl:text>
43         <xsl:value-of select="$newline"/>
44         <xsl:value-of select="$newline"/>
45       </xsl:when>
46     </xsl:choose>
47     
48     <xsl:if test="not(@result='OLDSHOW')">
49         <xsl:call-template name="programTable"/>
50     </xsl:if>
51     
52   </xsl:template>
53   
54   <xsl:template name="addProgramInfo">
55     <xsl:text>*</xsl:text>
56     <xsl:value-of select="interval/begin"/> - <xsl:value-of select="interval/end"/>
57     <xsl:text>: </xsl:text>
58     <xsl:value-of select="name"/>
59     <xsl:text>(</xsl:text>
60     <xsl:value-of select="channel"/>
61     <xsl:text>/</xsl:text><xsl:value-of select="keywords"/>
62     <xsl:text>)</xsl:text>
63     <xsl:value-of select="$newline"/> 
64     <xsl:variable name="indent">
65       <xsl:text>    </xsl:text>
66     </xsl:variable>
67     <xsl:call-template name="indent">
68       <xsl:with-param name="src">
69         <xsl:call-template name="word-wrap">
70           <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
71           <xsl:with-param name="width"><xsl:value-of select="72"/></xsl:with-param>
72         </xsl:call-template>    
73       </xsl:with-param>
74       <xsl:with-param name="indentString">
75         <xsl:text>    </xsl:text>
76       </xsl:with-param>
77       
78     </xsl:call-template>
79     
80     <!-- 
81     <xsl:value-of select="$indent"/>
82     <xsl:call-template name="string-replace">
83       <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
84       <xsl:with-param name="from"><xsl:value-of select="$newline"/></xsl:with-param>
85       <xsl:with-param name="to"><xsl:value-of select="$newline"/><xsl:value-of select="$indent"/></xsl:with-param>
86     </xsl:call-template>
87       -->
88     <xsl:value-of select="$newline"/>
89     <xsl:value-of select="$newline"/>  
90   </xsl:template>
91   
92   <xsl:template match="program">
93     <xsl:call-template name="addProgramInfo"/>
94   </xsl:template>
95   
96   <xsl:template match="interesting">
97     <xsl:call-template name="programTable"/>
98     <xsl:apply-templates select="category"/>
99   </xsl:template>
100   
101   <xsl:template match="category">
102     <xsl:text>Category: </xsl:text><xsl:value-of select="@name"/>
103     <xsl:value-of select="$newline"/>
104     <xsl:value-of select="$newline"/>
105     <xsl:call-template name="programTable"/>
106   </xsl:template>
107   
108 </xsl:stylesheet>