<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0"
    exclude-result-prefixes="x">
    <xsl:output method="html" encoding="UTF-8" indent="yes" cdata-section-elements="x:style x:script"/>
    <xsl:strip-space elements="*"/>
    <xsl:preserve-space elements="x:script x:style"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="x:head">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
            <style type="text/css"><![CDATA[
        
#player {
    padding: 10px;
    background-color: gray;
    position:fixed;
    top: 20px;
    right:10px
}
                    
                    ]]></style>
            <script type="text/javascript"><![CDATA[
                
function play(surl) {
  document.getElementById("player").innerHTML=
    '<embed src="'+surl+'" hidden="false" autostart="true" loop="false"/>';
}
               
                ]]></script>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="x:body">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
            <div id="player">A media player<br/>will pop-up here.</div>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="x:a[@rel='enclosure']/@href">
        <xsl:attribute name="href">
            <xsl:text>javascript:play("</xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>");</xsl:text>
        </xsl:attribute>
    </xsl:template>
    
    <xsl:template match="x:a[@rel='enclosure']/text()">
        <xsl:text>play</xsl:text>
    </xsl:template>
    
</xsl:stylesheet>
