(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 16 Mar 2006 18:55:19 +0000 (18:55 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 16 Mar 2006 18:55:19 +0000 (18:55 +0000)
crawler/kiss/conf/kiss/channel-overview.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/channel-right-now.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/channels-favorites.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/identity.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/login.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/program-info.xsl [new file with mode: 0644]
crawler/kiss/conf/kiss/utilities.xsl [new file with mode: 0644]

diff --git a/crawler/kiss/conf/kiss/channel-overview.xsl b/crawler/kiss/conf/kiss/channel-overview.xsl
new file mode 100644 (file)
index 0000000..59c807b
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  version="1.0">
+  
+  <xsl:output method="xml"/>
+  <xsl:strip-space elements="xhtml:a"/>
+  
+  <xsl:include href="utilities.xsl"/>
+  
+  <!-- =====================================================
+    Copying template.
+    ===================================================== -->
+  <xsl:template match="@*|node()" mode="copy">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="copy"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="/">
+    <xsl:element name="channel-overview">
+      <xsl:apply-templates select="//xhtml:a"/>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="xhtml:a">
+     <xsl:variable name="type">
+       <xsl:choose>
+         <xsl:when test="contains(text(), 'Right now')">
+           <xsl:text>right-now</xsl:text>
+         </xsl:when>
+         <xsl:when test="contains(text(), 'Evening')">
+           <xsl:text>evening</xsl:text>
+         </xsl:when>
+         <xsl:when test="contains(text(), 'Afternoon')">
+           <xsl:text>afternoon</xsl:text>
+         </xsl:when>
+         <xsl:when test="contains(text(), 'Noon')">
+           <xsl:text>noon</xsl:text>
+         </xsl:when>
+         <xsl:when test="contains(text(), 'Morning')">
+           <xsl:text>morning</xsl:text>
+         </xsl:when>
+         <xsl:when test="contains(text(), 'Tomorrow')">
+           <xsl:text>tomorrow</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:call-template name="string-replace">
+             <xsl:with-param name="src" select="text()"/>
+             <xsl:with-param name="from" select="$newline"/>
+             <xsl:with-param name="to" select="''"/>
+           </xsl:call-template>
+         </xsl:otherwise>
+       </xsl:choose>
+       
+     </xsl:variable>
+     <xsl:element name="action">
+       <xsl:attribute name="name">
+           <xsl:value-of select="$type"/>  
+       </xsl:attribute>
+       <xsl:attribute name="type">
+         <xsl:value-of select="$type"/>
+       </xsl:attribute>
+       <xsl:attribute name="reference">
+         <xsl:value-of select="@href"/>
+       </xsl:attribute>
+       <xsl:text>
+         
+       </xsl:text>
+     </xsl:element>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/channel-right-now.xsl b/crawler/kiss/conf/kiss/channel-right-now.xsl
new file mode 100644 (file)
index 0000000..5885f71
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  version="1.0">
+  
+  <xsl:output method="xml"/>
+  <xsl:strip-space elements="xhtml:a"/>
+  
+  <xsl:include href="utilities.xsl"/>
+  
+  <!-- =====================================================
+    Copying template.
+    ===================================================== -->
+  <xsl:template match="@*|node()" mode="copy">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="copy"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="/">
+    <xsl:element name="channel-right-now">
+      <xsl:apply-templates select="//xhtml:a"/>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="xhtml:a[ count(following::xhtml:a) >= 3]">
+     <xsl:element name="action">
+       <xsl:attribute name="name">
+         <xsl:call-template name="string-replace">
+           <xsl:with-param name="src" select="text()"/>
+           <xsl:with-param name="from" select="$newline"/>
+           <xsl:with-param name="to" select="''"/>
+         </xsl:call-template>
+       </xsl:attribute>
+       <xsl:attribute name="type">
+         <xsl:text>program-info</xsl:text>
+       </xsl:attribute>
+       <xsl:attribute name="reference">
+         <xsl:value-of select="@href"/>
+       </xsl:attribute>
+       <xsl:element name="time">
+         <xsl:value-of select="preceding-sibling::text()[1]"/>
+       </xsl:element>
+     </xsl:element>
+    <xsl:text>
+      
+    </xsl:text>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/channels-favorites.xsl b/crawler/kiss/conf/kiss/channels-favorites.xsl
new file mode 100644 (file)
index 0000000..ec9b1d6
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  version="1.0">
+  
+  <xsl:output method="xml"/>
+  <xsl:strip-space elements="xhtml:a"/>
+  
+  <xsl:include href="utilities.xsl"/>
+  
+  <!-- =====================================================
+    Copying template.
+    ===================================================== -->
+  <xsl:template match="@*|node()" mode="copy">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="copy"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="/">
+    <xsl:element name="favorite-channels">
+      <xsl:apply-templates select="//xhtml:a"/>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="xhtml:a[not(contains(@href, 'reload')) and text() != 'Back' and text() != 'Home' and text() != 'Logout' ]">
+     <xsl:element name="action">
+       <xsl:attribute name="name">
+         <xsl:call-template name="string-replace">
+           <xsl:with-param name="src" select="text()"/>
+           <xsl:with-param name="from" select="$newline"/>
+           <xsl:with-param name="to" select="''"/>
+         </xsl:call-template>
+       </xsl:attribute>
+       <xsl:attribute name="reference">
+         <xsl:value-of select="@href"/>
+       </xsl:attribute>
+       <xsl:attribute name="type"><xsl:text>channel-overview</xsl:text></xsl:attribute>
+     </xsl:element>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/identity.xsl b/crawler/kiss/conf/kiss/identity.xsl
new file mode 100644 (file)
index 0000000..ff5ec35
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+  <!-- =====================================================
+    By default, simply copy everything 
+    ===================================================== -->
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="body">
+    Hello!!!
+  </xsl:template>
+  
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/login.xsl b/crawler/kiss/conf/kiss/login.xsl
new file mode 100644 (file)
index 0000000..069cb93
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    version="1.0">
+    
+    <xsl:output method="xml"/>
+    <xsl:strip-space elements="*"/>
+    
+    <!-- =====================================================
+        Copying template.
+        ===================================================== -->
+    <xsl:template match="@*|node()" mode="copy">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()" mode="copy"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="/">
+        <xsl:element name="login">
+            <xsl:apply-templates select="//xhtml:a"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="xhtml:a">
+        <xsl:variable name="type">
+            <xsl:choose>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 's on now?')">
+                    <xsl:text>channels-whats-on-now</xsl:text>
+                </xsl:when>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 's on?')">
+                    <xsl:text>channels-whats-on</xsl:text>
+                </xsl:when>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 'Favorites')">
+                    <xsl:text>channels-favorites</xsl:text>
+                </xsl:when>
+                
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 's on?')">
+                    <xsl:text>shows-whats-on</xsl:text>
+                </xsl:when>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Search a show')">
+                    <xsl:text>shows-search</xsl:text>
+                </xsl:when>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Favorites')">
+                    <xsl:text>shows-favorites</xsl:text>
+                </xsl:when>
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Add a favorite')">
+                    <xsl:text>shows-add-favorite</xsl:text>
+                </xsl:when>
+                
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Movies'] and contains(text(), 's on?')">
+                    <xsl:text>movies-whats-on</xsl:text>
+                </xsl:when>
+                
+                
+                <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Sports'] and contains(text(), 's on?')">
+                    <xsl:text>sports-whats-on</xsl:text>
+                </xsl:when>
+                
+                <xsl:when test="contains(text(), 'Logout')">
+                    <xsl:text>logout</xsl:text>
+                </xsl:when>
+                <xsl:when test="contains(text(), 'Manual')">
+                    <xsl:text>manual-recording</xsl:text>
+                </xsl:when>
+                <xsl:when test="contains(text(), 'View')">
+                    <xsl:text>view-recordings</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                    unknown
+                    <xsl:value-of select="text()"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:element name="action">
+            <xsl:attribute name="name"><xsl:value-of select="$type"/></xsl:attribute>
+            <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
+            <xsl:attribute name="reference"><xsl:value-of select="@href"/></xsl:attribute>
+        </xsl:element>
+    </xsl:template>
+    
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/program-info.xsl b/crawler/kiss/conf/kiss/program-info.xsl
new file mode 100644 (file)
index 0000000..a47990b
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  version="1.0">
+  
+  <xsl:output method="xml"/>
+  <xsl:strip-space elements="xhtml:a"/>
+  
+  <xsl:include href="utilities.xsl"/>
+  
+  <!-- =====================================================
+    Copying template.
+    ===================================================== -->
+  <xsl:template match="@*|node()" mode="copy">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="copy"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="/">
+    <xsl:element name="program-info">
+      <xsl:apply-templates select="//xhtml:a"/>
+      <xsl:element name="title">
+        <xsl:value-of select="//xhtml:h2[1]"/>
+      </xsl:element>
+      <xsl:element name="keywords">
+        <xsl:apply-templates select="//text()[count(preceding::xhtml:br)= 1]"/>
+      </xsl:element>
+      <xsl:element name="description">
+        <xsl:apply-templates select="//text()[count(preceding::xhtml:h2) = 2 and
+          count(following::xhtml:br) >= 4 and count(preceding::xhtml:br) >= 3]"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  
+  
+  
+  <xsl:template match="xhtml:a[ text() = 'Record' ]">
+     <xsl:element name="action">
+       <xsl:attribute name="name">
+         <xsl:text>record</xsl:text>
+       </xsl:attribute>
+       <xsl:attribute name="reference">
+         <xsl:value-of select="@href"/>
+       </xsl:attribute>
+       <xsl:text>
+         
+       </xsl:text>
+     </xsl:element>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
diff --git a/crawler/kiss/conf/kiss/utilities.xsl b/crawler/kiss/conf/kiss/utilities.xsl
new file mode 100644 (file)
index 0000000..04e4c68
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Note the declaration of the namespace for XInclude. -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+  
+  
+  <xsl:variable name="newline">
+    <xsl:text>&#10;</xsl:text>
+  </xsl:variable>
+  
+  <xsl:variable name="carriageReturn">
+    <xsl:text>&#13;&#10;</xsl:text>
+  </xsl:variable>
+
+  <!-- =====================================================
+    Replace one string by another
+    - src: string to do substituion in
+    - from: literal string to replace
+    - to:substitution string.
+    ======================================================-->
+  <xsl:template name="string-replace">
+    <xsl:param name="src"/>
+    <xsl:param name="from"/>
+    <xsl:param name="to"/>
+    <xsl:choose>
+      <xsl:when test="contains($src, $from)">
+        <xsl:value-of select="substring-before($src, $from)"/>
+        <xsl:value-of select="$to"/>
+        <xsl:call-template name="string-replace">
+          <xsl:with-param name="src" select="substring-after($src, $from)"/>
+          <xsl:with-param name="from" select="$from"/>
+          <xsl:with-param name="to" select="$to"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$src"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+</xsl:stylesheet>