﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:local="urn:local" extension-element-prefixes="msxsl">
	<xsl:output method="xml" indent="yes"/>

	<msxsl:script language="CSharp" implements-prefix="local">
		public string dateTimeNow()
		{
			//String date = DateTime.Now.ToString("yyyyMMddTHHmmsszzz");
			String date = DateTime.Now.ToString("yyyyMMddTHH0000zzz");
			date = date.Replace(":", String.Empty);
			return date;
		}
	</msxsl:script>

	<!-- main template -->
	<xsl:template match="text()|@*"/>
	
	<xsl:template match="/">
		<nitf version="-//IPTC//DTD NITF 3.6//EN" change.date="September 11, 2009" change.time="12:26">
			<head>
				<title>FBO-<xsl:value-of select="//dataContainer[@type='2']/dataBlocs/dataBloc/dataList/data/value" />-Sums-<xsl:value-of select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'awayTeamName']/../../../../outputs/output[@type='Raw']" />-<xsl:value-of select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'homeTeamName']/../../../../outputs/output[@type='Raw']" />
				</title>
				<!-- LIBELLE GROUPE PAGE / PAGE -->
				<tobject tobject.type="news">
					<tobject.property tobject.property.type="current" />
					<tobject.subject tobject.subject.ipr="IPTC" />
				</tobject>
				<docdata management-status="usable">
					<!--<doc-id id-string="090feaaa6d3144a6b576cb297878882f" />-->
					<doc-id />
					<doc.copyright holder="SoHO Sports. All rights reserved." year="2013" />
					<doc-scope scope="Agate" />
					<date.expire norm="YYYYMMDD000000-HHMM" />
					<xsl:variable name="dateTimeNow" select="local:dateTimeNow()" />
					<date.issue norm="{$dateTimeNow}" />
					<!--<date.issue norm="YYYYMMDD000000-HHMM" />-->
					<!-- DATE EXPORT -->
					<date.release norm="YYYYMMDD000000-HHMM" />
					<ed-msg info="" />
					<key-list>
						<keyword>Agate</keyword>
					</key-list>
					<series series.part="0" series.totalpart="0" />
				</docdata>
				<urgency ed-urg="5" />
			</head>
			<body>
				<body.head>
					<hedline>
						<hl1>FBO-Sums</hl1>
						<hl2>FBO-Sums</hl2>
					</hedline>
					<byline>
						<person/>
						<byttl>SoHO Sports</byttl>
					</byline>
					<dateline>
						<location>
							<city/>
							<state/>
							<country/>
						</location>
						<story.date norm="20120925T161006-0400" />
					</dateline>
					<distributor>SOHO SPORTS</distributor>
					<abstract>
						<media>
							<media-metadata name="TransRef" value="" />
						</media>
					</abstract>
				</body.head>
				<body.content>
					<block id="CPARTICLE">
						<xsl:apply-templates />
					</block>
				</body.content>
			</body>
		</nitf>
	</xsl:template>	

	<xsl:template match="dataContainers">

		<xsl:variable name="shotsongoal">
			<xsl:element name="table">
				<xsl:attribute name="border">1</xsl:attribute>
				<xsl:attribute name="cellSpacing">1</xsl:attribute>
				<xsl:attribute name="cellPadding">1</xsl:attribute>
				
				<xsl:element name="tbody">	
					<xsl:apply-templates name="statistics" mode="statistics" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum PointsPeriod']/../../../../outputs/output[@type='Web']/value" />
				</xsl:element>				
			</xsl:element>
			<xsl:element name="br"></xsl:element>
		</xsl:variable>

		<xsl:variable name="attendance">
			<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'attendance']/../../../../outputs/output[@type='Raw']" />
			<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'locale_itl']/../../../../outputs/output[@type='Raw']" />
		</xsl:variable>

		<!-- EVENTS -->
		<xsl:apply-templates />

    <xsl:copy-of select="$shotsongoal"/>
    
		<p>
			<xsl:value-of select="$attendance" disable-output-escaping="yes" />
		</p>
    
    <!-- STATS -->
    <table>
      <tr>
        <td><b>TEAM STATISTICS</b></td>
        <td>
          <b><xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL-T2-HEADER stats BOLD']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='NomEquipeVisiteuse']/text()" /></b>
        </td>
        <td>
          <b><xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL-T2-HEADER stats BOLD']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='NomEquipeReceveuse']/text()" /></b>
        </td>        
      </tr>
      <tr>
        <td>First downs</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FirstDowns Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='TFDM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FirstDowns Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='TFDM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Yards rushing</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RushYards Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='RNYM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RushYards Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='RNYM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Yards passing</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Passing Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PYGM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Passing Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PYGM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Total offence</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum TotalOffence Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='GTNYm']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum TotalOffence Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='GTNYm']/text()" />
        </td>
      </tr>
      <tr>
        <td>Passes made-tried</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum CompAttInt Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PAM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum CompAttInt Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PMM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum CompAttInt Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PAM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum CompAttInt Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PMM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Returns yards</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum ReturnsTotalYArds Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='NKRYM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum ReturnsTotalYArds Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='NKRYM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Interceptions-yards by</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum IntercReturns Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='IntRAm']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum IntercReturns Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='IRYM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum IntercReturns Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='IntRAm']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum IntercReturns Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='IRYM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Fumbles-Lost</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FumblesLost Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='FML']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FumblesLost Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='FM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FumblesLost Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='FML']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum FumblesLost Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='FM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Sacks by</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum Sack Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='SKTM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum Sack Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='SKTM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Punts-average</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Punt-Returns Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PRYsM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Punt-Returns Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PRTM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Punt-Returns Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PRYsM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum Punt-Returns Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PRTM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Penalties-Yards</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum PenaltiesYards Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PYM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum PenaltiesYards Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum PenaltiesYards Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PYM']/text()" />-<xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum PenaltiesYards Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='PM']/text()" />
        </td>
      </tr>
      <tr>
        <td>Time of Possession</td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum TimePoss Aw']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='TOPM']/text()" />
        </td>
        <td>
          <xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'NFL Inc-Sum TimePoss Ho']/../../../../outputs/output[@type='Web']/value/dataCell/element[@type='TOPM']/text()" />
        </td>
      </tr>      
    </table>
    <p><xsl:apply-templates name="selectRaw" mode="selectRaw" select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'netOffence_text']/../../../../outputs/output[@type='Raw']" /></p>
    <p><b>INDIVIDUAL STATISTICS</b></p>
    <p><b>Rushing</b></p>
    <p>
      <xsl:for-each select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RUSHING-header']/../../../../outputs/output[@type='Raw']">
        <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" />
        <xsl:for-each select="../../../dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RUSHING']/../../../../outputs/output[@type='Raw']">
          <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" /></xsl:for-each>
      </xsl:for-each>
    </p>
    <p><b>Receiving</b></p>
    <p>
      <xsl:for-each select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RECEIVING-header']/../../../../outputs/output[@type='Raw']">
        <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" />
        <xsl:for-each select="../../../dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum RECEIVING']/../../../../outputs/output[@type='Raw']">
          <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" />
        </xsl:for-each>
      </xsl:for-each>
    </p>
    <p><b>Passing</b></p>
    <p>
      <xsl:for-each select="//dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum PASSING-header']/../../../../outputs/output[@type='Raw']">
        <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" />
        <xsl:for-each select="../../../dataBloc/styleContainer/styles/style[@name='StyleSheet']/value[text() = 'CFL Inc-Sum PASSING']/../../../../outputs/output[@type='Raw']">
          <xsl:value-of name="selectRaw" mode="selectRaw" select="." disable-output-escaping="yes" />
        </xsl:for-each>
      </xsl:for-each>
    </p>
    
	</xsl:template>
	
	<!-- NAMED TEMPLATES (stats and headers) -->
	<xsl:template name="statistics" mode="statistics" match="value">
		<xsl:element name="tr">
			<xsl:apply-templates mode="statisticsLine" select="dataCell" />
		</xsl:element>
	</xsl:template>

	<xsl:template name="statisticsLine" mode="statisticsLine" match="element">
		<xsl:element name="td">
			<xsl:value-of select="text()" />
		</xsl:element>
	</xsl:template>
	
	<xsl:template name="goalies" mode="goalies" match="value">		
		<xsl:value-of select="." />
	</xsl:template>

	<xsl:template name="selectRaw" mode="selectRaw" match="value">
		<xsl:call-template name="text-replacer">
			<xsl:with-param name="text-to-replace"><xsl:value-of select="." disable-output-escaping="yes" /></xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<!-- END NAMED TEMPLATES -->
	
	<!-- RECURSIVE TEMPLATES (events or headers) -->
	<xsl:template match="dataContainer">
		<xsl:choose>
			<!-- header line -->
			<xsl:when test="@type = '2' or @type = '3' or @type = '4'">
				<p>
					<xsl:value-of select="./dataBlocs/dataBloc/dataList/data/value" />
				</p>
			</xsl:when>
			<xsl:when test="@type = '5' or @type = '6' or @type = '8'">
				<xsl:apply-templates />
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="dataBlocs">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="dataBloc">	
		<xsl:choose>
			<xsl:when test="styleContainer/styles/style[@name='StyleSheet']/value[text() != 'CFL-T2-HEADER stats BOLD'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'netOffence_text'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'ind_stats_header'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'ind_stats_rushing_header'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'ind_stats_receiving_header']
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'ind_stats_passing_header']
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'referee'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'linesman'] 
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'attendance']
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'locale_itl']
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'awayTeamName']
						and styleContainer/styles/style[@name='StyleSheet']/value[text() != 'homeTeamName']">
				<p><xsl:apply-templates select="./outputs/output[@type='Raw']" /></p>
			</xsl:when>
			<xsl:when test="styleContainer/styles/style[@name='StyleSheet']/value = ''">
				<xsl:variable name="content">
					<xsl:apply-templates select="./outputs/output[@type='Raw']" />
				</xsl:variable>
				<xsl:if test="$content != ''">
					<p><xsl:copy-of select="$content"></xsl:copy-of></p>
				</xsl:if>
			</xsl:when>
		</xsl:choose>		
	</xsl:template>

	<!-- END RECURSIVE TEMPLATES -->

	<xsl:template match="value">
		<xsl:call-template name="text-replacer">
			<xsl:with-param name="text-to-replace"><xsl:value-of select="." /></xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	
	<xsl:template name="text-replacer">
		<xsl:param name="text-to-replace"/>
		<xsl:variable name="myVar">
			<xsl:call-template name="string-replace-all">
				<xsl:with-param name="text" select="$text-to-replace" />
				<xsl:with-param name="replace" select="'\n'" />
				<xsl:with-param name="by" select="''" />
			</xsl:call-template>
		</xsl:variable>		 
		<xsl:variable name="myVar2">
			<xsl:call-template name="string-replace-all">
				<xsl:with-param name="text" select="$myVar" />
				<xsl:with-param name="replace" select="'..'" />
				<xsl:with-param name="by" select="'.'" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:value-of select="$myVar2" disable-output-escaping="yes" />
	</xsl:template>

	<xsl:template name="string-replace-all">
		<xsl:param name="text" />
		<xsl:param name="replace" />
		<xsl:param name="by" />
		<xsl:choose>
			<xsl:when test="contains($text, $replace)">
				<xsl:value-of select="substring-before($text,$replace)" />
				<xsl:value-of select="$by" />
				<xsl:call-template name="string-replace-all">
					<xsl:with-param name="text" select="substring-after($text,$replace)" />
					<xsl:with-param name="replace" select="$replace" />
					<xsl:with-param name="by" select="$by" />
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

</xsl:stylesheet>