﻿<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:sportsml="http://www.sportsml.org/schema/"
	>
<xsl:variable name="teams" select="document('schema/resource-files/team-keys-l.nhl.com.xsd')" />


<xsl:template match="sportsml:sports-content">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="sportsml:sports-metadata">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="sportsml:sports-title">
	<h3>Le Title: <xsl:apply-templates/></h3>
</xsl:template>

<xsl:template match="sportsml:sports-event">
	<h5> 
		<xsl:for-each select="sportsml:team">
			<xsl:variable name="teamkey" select="sportsml:team-metadata/@team-key"/>
			<xsl:text>Les </xsl:text>
			<xsl:value-of select="$teams/xsd:schema/xsd:simpleType/xsd:restriction/xsd:enumeration[@value=$teamkey]/xsd:annotation/xsd:appinfo/xsd:lastname"/>
			<xsl:text> de </xsl:text>
			<xsl:value-of select="$teams/xsd:schema/xsd:simpleType/xsd:restriction/xsd:enumeration[@value=$teamkey]/xsd:annotation/xsd:appinfo/xsd:firstname"/>
			<xsl:text>: </xsl:text>
			<xsl:value-of select="sportsml:team-stats/@score"/>
			<br/>
		</xsl:for-each>
	</h5>
</xsl:template>

</xsl:stylesheet>
