4a3560a41f59c9f42e488d0974220418ccae673c
[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:call-template name="programTable"/>
49     
50   </xsl:template>
51   
52   <xsl:template name="addProgramInfo">
53     <xsl:text>*</xsl:text>
54     <xsl:value-of select="interval/begin"/> - <xsl:value-of select="interval/end"/>
55     <xsl:text>: </xsl:text>
56     <xsl:value-of select="name"/>
57     <xsl:text>(</xsl:text>
58     <xsl:value-of select="channel"/>
59     <xsl:text>/</xsl:text><xsl:value-of select="keywords"/>
60     <xsl:text>)</xsl:text>
61     <xsl:value-of select="$newline"/> 
62     <xsl:variable name="indent">
63       <xsl:text>    </xsl:text>
64     </xsl:variable>
65     <xsl:call-template name="indent">
66       <xsl:with-param name="src">
67         <xsl:call-template name="word-wrap">
68           <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
69           <xsl:with-param name="width"><xsl:value-of select="72"/></xsl:with-param>
70         </xsl:call-template>    
71       </xsl:with-param>
72       <xsl:with-param name="indentString">
73         <xsl:text>    </xsl:text>
74       </xsl:with-param>
75       
76     </xsl:call-template>
77     
78     <!-- 
79     <xsl:value-of select="$indent"/>
80     <xsl:call-template name="string-replace">
81       <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
82       <xsl:with-param name="from"><xsl:value-of select="$newline"/></xsl:with-param>
83       <xsl:with-param name="to"><xsl:value-of select="$newline"/><xsl:value-of select="$indent"/></xsl:with-param>
84     </xsl:call-template>
85       -->
86     <xsl:value-of select="$newline"/>
87     <xsl:value-of select="$newline"/>  
88   </xsl:template>
89   
90   <xsl:template match="program">
91     <xsl:call-template name="addProgramInfo"/>
92   </xsl:template>
93   
94   <xsl:template match="interesting">
95     <xsl:call-template name="programTable"/>
96     <xsl:apply-templates select="category"/>
97   </xsl:template>
98   
99   <xsl:template match="category">
100     <xsl:text>Category: </xsl:text><xsl:value-of select="@name"/>
101     <xsl:value-of select="$newline"/>
102     <xsl:value-of select="$newline"/>
103     <xsl:call-template name="programTable"/>
104   </xsl:template>
105   
106 </xsl:stylesheet>