<?xml version="1.0"?>
<!--
	Copyright (C) Microsoft Corporation 2003.
	All rights reserved.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

	<!-- including entity template -->
	<!-- @todo need to move to build time -->
	<xsl:include href='entities.xsl'/>

	<!-- formatting templates -->

	<!-- highlighting in an article -->
	<xsl:template match="highlight">
		<span style='background-color:#FFFAB8'>
			<xsl:if test='@first'>
				<xsl:attribute name='id'>firsthl</xsl:attribute>
			</xsl:if>
			<xsl:value-of select='.'/>
		</span>
	</xsl:template>

	<!-- highlighting in a media caption 
	<xsl:template match="highlight[ancestor::caption or ancestor::quickfacts]">
		<span style='background-color:#826E33'>
			<xsl:value-of select='.'/>
		</span>
	</xsl:template>
	-->

	<!-- need this for media captions --> 
	<xsl:template match="break">
		<xsl:if test='position()!=1'><br/><br/></xsl:if>
	</xsl:template>

	<xsl:template match="u"><u><xsl:apply-templates /></u></xsl:template>
	<xsl:template match="br"><br/></xsl:template>
	
	<xsl:template match="eref">
		<a>
			<xsl:attribute name="href">
				<xsl:value-of select="./@href"/>
			</xsl:attribute>
			<xsl:apply-templates/>
		</a>
	</xsl:template>

	<!-- @review For some reason 'font-variant:small-caps' does not reduce the font size (added 'font-size:75%' to compensate) -->
	<xsl:template match="smallcaps"><span style='font-variant:small-caps'><xsl:apply-templates /></span></xsl:template>
	<!-- @review scp appears in just captions, I believe, and 75% is too small; using %80 looks a lot better) -->
	<xsl:template match="scp"><span style='font-variant:small-caps'><xsl:apply-templates /></span></xsl:template>
	<xsl:template match="small"><span style='font-size:75%'><xsl:apply-templates /></span></xsl:template>

	<!-- Added uses_entities param for the case when italic, superscript, etc. text is passed as an attribute to the embedded window control -->
	<xsl:template match="sup">
		<xsl:param name="uses_entities" select="'0'"/>
		<xsl:choose>
			<xsl:when test="$uses_entities='0'"><sup><xsl:apply-templates /></sup></xsl:when>
			<xsl:otherwise>&lt;sup&gt;<xsl:apply-templates />&lt;/sup&gt;</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="sub | inf">
		<xsl:param name="uses_entities" select="'0'"/>
		<xsl:choose>
			<xsl:when test="$uses_entities='0'"><sub><xsl:apply-templates /></sub></xsl:when>
			<xsl:otherwise>&lt;sub&gt;<xsl:apply-templates />&lt;/sub&gt;</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="i | it">
		<xsl:param name="uses_entities" select="'0'"/>
		<xsl:choose>
			<xsl:when test="$uses_entities='0'"><i><xsl:apply-templates /></i></xsl:when>
			<xsl:otherwise>&lt;i&gt;<xsl:apply-templates />&lt;/i&gt;</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="b"><b><xsl:apply-templates /></b></xsl:template>

</xsl:stylesheet>
