-<?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>