stylesheets are now searched in the classpath.
[utils] / crawler / kiss / src / reportToText.xsl
diff --git a/crawler/kiss/src/reportToText.xsl b/crawler/kiss/src/reportToText.xsl
new file mode 100644 (file)
index 0000000..9d85cfa
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="text"/>
+  
+  <xsl:include href="utilities.xsl"/>
+  <xsl:template match="report">
+    <xsl:text>KiSS crawler report</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:value-of select="$newline"/>
+    
+    <xsl:apply-templates select="recorded"/>
+    <xsl:if test="count(interesting) > 0">
+      <xsl:text>Possibly interesting programs</xsl:text>
+      <xsl:value-of select="$newline"/>
+      <xsl:value-of select="$newline"/>
+      
+      <xsl:apply-templates select="interesting"/>
+    </xsl:if>
+  </xsl:template>
+  
+  <xsl:template name="programTable">
+    <xsl:apply-templates select="program"/>
+  </xsl:template>
+  <xsl:template match="recorded">
+    <xsl:choose>
+      <xsl:when test="@result = 'OK'">
+        <xsl:text>Successfully recorded programs </xsl:text>
+        <xsl:value-of select="$newline"/>
+        <xsl:value-of select="$newline"/>
+      </xsl:when>
+      <xsl:when test="@result = 'DUPLICATE'">
+        <xsl:text>Already recorded programs</xsl:text>
+        <xsl:value-of select="$newline"/>
+        <xsl:value-of select="$newline"/>
+      </xsl:when>
+      <xsl:when test="@result = 'CONFLICT'">
+        <xsl:text>Conflicts with other recorded program</xsl:text>
+        <xsl:value-of select="$newline"/>
+        <xsl:value-of select="$newline"/>
+      </xsl:when>
+      <xsl:when test="@result='ERROR'">
+        <xsl:text>Programs that could not be recorded for technical reasons.</xsl:text>
+        <xsl:value-of select="$newline"/>
+        <xsl:value-of select="$newline"/>
+      </xsl:when>
+    </xsl:choose>
+    
+    <xsl:call-template name="programTable"/>
+    
+  </xsl:template>
+  
+  <xsl:template name="addProgramInfo">
+    <xsl:text>*</xsl:text>
+    <xsl:value-of select="interval/begin"/> - <xsl:value-of select="interval/end"/>
+    <xsl:text>: </xsl:text>
+    <xsl:value-of select="name"/>
+    <xsl:text>(</xsl:text>
+    <xsl:value-of select="channel"/>
+    <xsl:text>/</xsl:text><xsl:value-of select="keywords"/>
+    <xsl:text>)</xsl:text>
+    <xsl:value-of select="$newline"/> 
+    <xsl:variable name="indent">
+      <xsl:text>    </xsl:text>
+    </xsl:variable>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="src">
+        <xsl:call-template name="word-wrap">
+          <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
+          <xsl:with-param name="width"><xsl:value-of select="72"/></xsl:with-param>
+        </xsl:call-template>    
+      </xsl:with-param>
+      <xsl:with-param name="indentString">
+        <xsl:text>    </xsl:text>
+      </xsl:with-param>
+      
+    </xsl:call-template>
+    
+    <!-- 
+    <xsl:value-of select="$indent"/>
+    <xsl:call-template name="string-replace">
+      <xsl:with-param name="src"><xsl:value-of select="description"/></xsl:with-param>
+      <xsl:with-param name="from"><xsl:value-of select="$newline"/></xsl:with-param>
+      <xsl:with-param name="to"><xsl:value-of select="$newline"/><xsl:value-of select="$indent"/></xsl:with-param>
+    </xsl:call-template>
+      -->
+    <xsl:value-of select="$newline"/>
+    <xsl:value-of select="$newline"/>  
+  </xsl:template>
+  
+  <xsl:template match="program">
+    <xsl:call-template name="addProgramInfo"/>
+  </xsl:template>
+  
+  <xsl:template match="interesting">
+    <xsl:call-template name="programTable"/>
+    <xsl:apply-templates select="category"/>
+  </xsl:template>
+  
+  <xsl:template match="category">
+    <xsl:text>Category: </xsl:text><xsl:value-of select="@name"/>
+    <xsl:value-of select="$newline"/>
+    <xsl:value-of select="$newline"/>
+    <xsl:call-template name="programTable"/>
+  </xsl:template>
+  
+</xsl:stylesheet>