<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
    xmlns:m="http://search.yahoo.com/mrss/"
    xmlns:bl="http://www.blinkx.com/SmartFeedGuide.php"
    xmlns:v="http://www.google.com/schemas/sitemap-video/1.1"
    xmlns:a="http://www.w3.org/2005/Atom"
    xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
    <xsl:output method="html" encoding="UTF-8" indent="yes" exclude-result-prefixes="m v "/>
    <xsl:param name="inputURI"/>
    <xsl:param name="property"/>
    <xsl:template match="/">
        <xsl:variable name="inputDoc" select="document($inputURI)"/>        
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>                
                <title>Mappings of Media Annotations - Result</title>
            
            </head>
            <body>
                <h1>Mappings of Media Annotations - Result</h1>
                <ul>
                    <li>Media object URI: <a href="{$inputURI}"><xsl:value-of select="$inputURI"/></a></li>
                    <li>Property to be queried: <xsl:value-of select="$property"/></li>
                </ul>
                <p>Result:</p>
                <xsl:choose>
                    <xsl:when test="$property='title'">
                        <xsl:apply-templates select="$inputDoc//title | $inputDoc//m:title | $inputDoc//v:title | $inputDoc//a:entry/a:title | $inputDoc//dc:title"/>
                    </xsl:when>
                    <xsl:when test="$property='description'">
                        <xsl:apply-templates select="$inputDoc//description | $inputDoc//v:description | $inputDoc//a:content"/>
                    </xsl:when>
                    <xsl:when test="$property='dateGeneral'">
                        <xsl:apply-templates select="$inputDoc//pubDate | $inputDoc//v:publication_date| $inputDoc//a:entry/a:published | $inputDoc//a:updated | $inputDoc//dcterms:modified | $inputDoc//dcterms:created"/>
                    </xsl:when>
                    <xsl:when test="$property='pubdate'">
                        <xsl:apply-templates select="$inputDoc//pubDate | $inputDoc//v:publication_date| $inputDoc//a:entry/a:published"/>
                    </xsl:when>
                    <xsl:when test="$property='tags'">
                        <xsl:apply-templates select="$inputDoc//m:category | $inputDoc//v:tag"/>
                    </xsl:when>
                    <xsl:when test="$property='thumbnail'">
                        <xsl:apply-templates select="$inputDoc//m:thumbnail | $inputDoc//v:thumbnail_loc"/>
                    </xsl:when>
                    <xsl:when test="$property='player'">
                        <xsl:apply-templates select="$inputDoc//m:player | $inputDoc//v:player_loc"/>
                    </xsl:when>                    
                </xsl:choose>
                <hr/>
                <p><a href="http://www.w3.org/People/fsasaki/annotation-mappings/">query input page</a></p>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="*">
        <p>* Property value found: <xsl:value-of select=". | ../m:thumbnail/@url" disable-output-escaping="yes"/></p>
<p>Property name in input format: <xsl:value-of select="name()"/></p>
    </xsl:template>
</xsl:stylesheet>
