<!-- Dokumentelement des Stylesheets -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- Beispiel xsl:output -->
<xsl:output method="html" version="4.0" encoding="UTF-8" media-type="text/html"/>

<!-- template match="TITEL" und match="SZENE" in hamlet2.xsl ausgelagert -->
<xsl:include href="hamlet2.xsl"/>

<!-- Beispiel f&uuml;r die Deklaration und Initialisierung einer Variable -->
<xsl:variable name="backcolor" select="'#FFFFCC'" />

<!-- Dokumentwurzel und Literal Result Elements -->
<xsl:template match="AKT | PROLOGUE | EPILOGUE">
	<HTML>
	<HEAD>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
		<TITLE><xsl:value-of select="TITEL"/></TITLE>
	</HEAD>
	
	<!-- Benutzung der Variable {$backcolor} -->
	<BODY BGCOLOR='{$backcolor}'>
		<xsl:apply-templates/>
	</BODY>
	</HTML>
</xsl:template>

<xsl:template match="REDE">
	<TABLE>
		<TR>
			<TD WIDTH="160" VALIGN="TOP">
			
				<!-- Beispiel f&uuml;r xsl:apply-templates -->
				<xsl:apply-templates select="REDNER"/>
			</TD>
			<TD WIDTH="600" VALIGN="TOP">
				<xsl:apply-templates select="SPIELER | ZEILE"/>
			</TD>
		</TR>
	</TABLE>
</xsl:template>

<!-- Beispiel f&uuml;r priority, hier = 0 -->
<xsl:template match="REDNER">
	
	<font face="Arial"><xsl:apply-templates/>.</font>
</xsl:template>

<!-- Dieses Template wird ausgef&uuml;hrt, da priority = 0,5 -->
<xsl:template match="REDE/REDNER">
	
	<font face="Courier New"><xsl:apply-templates/>.</font>
</xsl:template>

<xsl:template match="SPIELORT">
	<I><CENTER><xsl:value-of select="."/></CENTER></I><BR/>
</xsl:template>

<xsl:template match="REDE/SPIELER">
	<I>(<xsl:value-of select="."/>)</I>
</xsl:template>

<xsl:template match="AKT/SPIELER">
	<I><CENTER>(<xsl:value-of select="."/>)</CENTER></I>
</xsl:template>

<!-- Beispiel f&uuml;r match -->
<xsl:template match="ZEILE/SPIELER">
	<I>(<xsl:value-of select="."/>)</I>
</xsl:template>

<xsl:template match="ZEILE">
	<xsl:apply-templates/>
	<!-- neue Variable -->
	<xsl:variable name="line-nr">
	
		<!-- Beispiel f&uuml;r xsl:number -->
		<xsl:number level="any"/>
	</xsl:variable>
	
	<!-- expliziter Aufruf des Templates ZEILENNUMMER -->
	<xsl:call-template name="ZEILENNUMMER">
	
			<!-- Parameter&uuml;bergabe der Variable {$line-nr} -->
			<xsl:with-param name="line" select="$line-nr" />
	</xsl:call-template>	
	
	<BR/>
	
</xsl:template>

<xsl:template match="KURSIV">
	<I><xsl:apply-templates/></I>
</xsl:template>

<xsl:template name="ZEILENNUMMER">
	<xsl:param name="line" />
	 
	<!-- Beispiel f&uuml;r eine if-Abfrage - nur jede f&uuml;nfte Zeile wird die Zeilennummer ausgegeben -->
	<xsl:if test="$line mod 5 = 0">
		
			
			<!-- Beispiel f&uuml;r xsl:value-of - der Wert der Variablen wird ausgegeben -->
			<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text><xsl:value-of select="$line"/>
			
	</xsl:if>
</xsl:template>

</xsl:stylesheet>
