59c807b12a516c8a1072ac9e798283cc38e6f2dc
[utils] / crawler / kiss / src / main / resources / channel-overview.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3   xmlns:xhtml="http://www.w3.org/1999/xhtml"
4   version="1.0">
5   
6   <xsl:output method="xml"/>
7   <xsl:strip-space elements="xhtml:a"/>
8   
9   <xsl:include href="utilities.xsl"/>
10   
11   <!-- =====================================================
12     Copying template.
13     ===================================================== -->
14   <xsl:template match="@*|node()" mode="copy">
15     <xsl:copy>
16       <xsl:apply-templates select="@*|node()" mode="copy"/>
17     </xsl:copy>
18   </xsl:template>
19   
20   <xsl:template match="/">
21     <xsl:element name="channel-overview">
22       <xsl:apply-templates select="//xhtml:a"/>
23     </xsl:element>
24   </xsl:template>
25   
26   <xsl:template match="xhtml:a">
27      <xsl:variable name="type">
28        <xsl:choose>
29          <xsl:when test="contains(text(), 'Right now')">
30            <xsl:text>right-now</xsl:text>
31          </xsl:when>
32          <xsl:when test="contains(text(), 'Evening')">
33            <xsl:text>evening</xsl:text>
34          </xsl:when>
35          <xsl:when test="contains(text(), 'Afternoon')">
36            <xsl:text>afternoon</xsl:text>
37          </xsl:when>
38          <xsl:when test="contains(text(), 'Noon')">
39            <xsl:text>noon</xsl:text>
40          </xsl:when>
41          <xsl:when test="contains(text(), 'Morning')">
42            <xsl:text>morning</xsl:text>
43          </xsl:when>
44          <xsl:when test="contains(text(), 'Tomorrow')">
45            <xsl:text>tomorrow</xsl:text>
46          </xsl:when>
47          <xsl:otherwise>
48            <xsl:call-template name="string-replace">
49              <xsl:with-param name="src" select="text()"/>
50              <xsl:with-param name="from" select="$newline"/>
51              <xsl:with-param name="to" select="''"/>
52            </xsl:call-template>
53          </xsl:otherwise>
54        </xsl:choose>
55        
56      </xsl:variable>
57      <xsl:element name="action">
58        <xsl:attribute name="name">
59            <xsl:value-of select="$type"/>  
60        </xsl:attribute>
61        <xsl:attribute name="type">
62          <xsl:value-of select="$type"/>
63        </xsl:attribute>
64        <xsl:attribute name="reference">
65          <xsl:value-of select="@href"/>
66        </xsl:attribute>
67        <xsl:text>
68          
69        </xsl:text>
70      </xsl:element>
71   </xsl:template>
72   
73   
74 </xsl:stylesheet>