--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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> </xsl:text>
+ </xsl:variable>
+
+ <xsl:variable name="carriageReturn">
+ <xsl:text> </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>