<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="ISO-8859-1" media-type="text/html"/>
<!--root-->
<!--
    Stylesheet for single event report

    Version 1.0.0.3

    Attention Logo: Placeholder "./logo.png" will be replaced from the caller of the
                    style sheet! (for example with "./logo.gif")
                    Details see Online Help chapter "Creation of individual network report"

	02.04.2007 Pietsch FGH Version 1.0.0.0
	05.09.2007 Pietsch 1.0.0.1
	27.11.2007 Noppatee
	11.12.2007 Noppatee		Failure occasion
    03.03.2008 Pietsch: details of affected station (transmission line/transformer)
    10.03.2008          supply interruptions
    25.03.2008          switching order with affected
    25.04.2008          first and last edit with local time format
	27.05.2008 Noppatee		Layout adjustment
	03.06.2008 Noppatee		Layout adjustment
    10.06.2008 Pietsch  e_d_v_rl_bc_dati with attribute "time_loc"
-->

<!-- variable "txt_list" will be evaluted by INTERASS.
     We expect a SPACE separated list of file types (suffix,extension)
     Document files with these suffixes will be treated as textfiles,
     otherwise a link will be shown
-->
<xsl:variable name="txt_list">log txt</xsl:variable>

<!-- variable "img_list"
     We expect a SPACE separated list of file types (suffix,extension)
     Document files with these suffixes will be treated as IMG files,
     otherwise a link will be shown
-->
<xsl:variable name="img_list">bmp gif jpg png</xsl:variable>

<xsl:template match="*|/">
	<html>
		<xsl:apply-templates select="Event-Data"/>
	</html>
</xsl:template>

<xsl:template match="Event-Data">
	<head>
		<title>Event Report</title>
	</head>
	<body>
		<xsl:apply-templates select="Event"/>
		<BR></BR>
		<!--footnote-->
		<table width="100%" border="0">
			<tr bgcolor="#ffffff">
				<td align="right"><FONT face="tohoma" style="font-size: 8pt"><i>
					<nobr>Created at:&#160;<xsl:value-of select="datum"/></nobr>
					&#160;
					<nobr><xsl:value-of select="uhrzeit"/></nobr>
				</i></FONT></td>
			</tr>
		</table>
	</body>
</xsl:template>

<xsl:template match="Event">
	<table width="100%" border="2" bordercolor="black">
		<tr bgcolor="#ffffff">
			<td align="left"><FONT face="tohoma" style="font-size: 11pt"><b><nobr>
         		Date:&#160;<xsl:value-of select="general/e_d_u_eventdate"/>
         	</nobr></b></FONT></td>
			<td align="right"><FONT face="tohoma" style="font-size: 11pt"><b><nobr>
         		<xsl:value-of select="general/e_d_s_controlcenter/@text"/>
         	</nobr></b></FONT></td>
		</tr>
	</table>
	<BR></BR>

	<xsl:variable name="eventdate" select="general/e_d_u_eventdate"/>
	<xsl:variable name="eventtime" select="general/e_d_v_eventtime"/>
	<table width="100%" border="0">
		<tr bgcolor="#ffffff">
			<td align="left">
				<table border="0">
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Event's name: <xsl:value-of select="general/e_d_s_eventname"/>
						&#160;
						"<xsl:value-of select="general/e_d_e_kindevent/@text"/> event"
						&#160;
						(Event's ID = <xsl:value-of select="general/e_d_i_evrid"/>)
					</nobr></i></FONT></td></tr>
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Event's time: <xsl:value-of select="$eventdate"/>&#160;<xsl:copy-of select="$eventtime"/>
					</nobr></i></FONT></td></tr>
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Chain status: <xsl:value-of select="general/e_d_e_kindchain/@text"/>
						<xsl:variable name="e_d_e_kindchain" select="general/e_d_e_kindchain"/>
						<xsl:choose><xsl:when test="$e_d_e_kindchain='2'">
							&#160;
							(Preceding event's ID = <xsl:value-of select="general/e_d_i_chainprevid"/>)
						</xsl:when><xsl:when test="$e_d_e_kindchain='3'">
							&#160;
							(Preceding event's ID = <xsl:value-of select="general/e_d_i_chainprevid"/>)
						</xsl:when></xsl:choose>
					</nobr></i></FONT></td></tr>
				</table>
			</td>
			<td align="right">
				<table border="0">
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Date last change: <xsl:value-of select="general/e_d_v_lastedit_date/@text"/>
						&#160;
						(Editor: <xsl:value-of select="general/e_d_s_lastedit_name"/>)
					</nobr></i></FONT></td></tr>
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Date first change: <xsl:value-of select="general/e_d_v_firstedit_date/@text"/>
						&#160;
						(Editor: <xsl:value-of select="general/e_d_s_firstedit_name"/>)
					</nobr></i></FONT></td></tr>
					<tr><td><FONT face="tohoma" style="font-size: 8pt"><i><nobr>
						Checking status: <xsl:value-of select="general/e_d_e_status/@text"/>
					</nobr></i></FONT></td></tr>
				</table>
			</td>
		</tr>
	</table>
	<BR></BR>

	<table border="0">
        <xsl:variable name="bv" select="general/e_d_b_superior"/>
        <xsl:choose><xsl:when test="$bv='1'">
        	<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Report to superior</nobr></FONT></td>
			</tr>
		</xsl:when></xsl:choose>
		
        <xsl:variable name="bv1" select="general/e_d_b_important"/>
        <xsl:choose><xsl:when test="$bv1='1'">
        	<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Important</nobr></FONT></td>
			</tr>
        </xsl:when></xsl:choose>
        
		<xsl:variable name="bv2" select="general/e_d_s_informedperson"/>
        <xsl:choose><xsl:when test="$bv2">
        	<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Informed person:</nobr></FONT></td>
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="general/e_d_s_informedperson"/></nobr></FONT></td>
			</tr>
		</xsl:when></xsl:choose>

		<xsl:variable name="bv3" select="general/e_d_e_kindevent"/>		<!--this will not be shown in 'visiting' and 'other' event-->
		<xsl:choose><xsl:when test="$bv3 != '9'">
			<xsl:choose><xsl:when test="$bv3 != '7'">
				<xsl:variable name="occasion" select="general/e_d_s_anlass"/>
				<xsl:choose><xsl:when test="$occasion">
					<tr bgcolor="#ffffff">
						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Failure occasion:</nobr></FONT></td>
						<xsl:choose><xsl:when test="starts-with($occasion,7)">
							<td><FONT face="tohoma" style="font-size: 9pt"><u><b><nobr><xsl:value-of select="$occasion"/>: <xsl:value-of select="general/e_d_s_anlass/@text"/></nobr></b></u></FONT></td>
						</xsl:when><xsl:otherwise>
							<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="$occasion"/>: <xsl:value-of select="general/e_d_s_anlass/@text"/></nobr></FONT></td>
						</xsl:otherwise></xsl:choose>
					</tr>
				</xsl:when></xsl:choose>
			</xsl:when></xsl:choose>
		</xsl:when></xsl:choose>
        
        <xsl:variable name="resp" select="e_ev_work/e_d_e_wp_respon"/>		<!--this will not be shown in 'equipment', 'visiting' and 'other' event-->
		<xsl:choose><xsl:when test="$bv3 != '9'">
			<xsl:choose><xsl:when test="$bv3 != '7'">
				<xsl:choose><xsl:when test="$bv3 != '6'">
					<xsl:variable name="bv4" select="general/e_d_l_district/item"/>
					<xsl:choose><xsl:when test="$bv4">
						<tr bgcolor="#ffffff">
							<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt"><nobr>District:</nobr></FONT></td>
							<td><table border="0">
	  							<xsl:for-each select="general/e_d_l_district/item">
									<tr bgcolor="#ffffff">
		    								<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
		    								<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@text"/></nobr></FONT></td>
	    							</tr>
	    						</xsl:for-each>
	    					</table></td>
	    				</tr>
					</xsl:when></xsl:choose>
				</xsl:when></xsl:choose>
			</xsl:when></xsl:choose>
		</xsl:when></xsl:choose>
	</table>
	<BR></BR>

	<xsl:apply-templates select="e_ev_undef"/>

	<!--e_ev_tmline		(0: Transmission line event)-->
	<xsl:apply-templates select="e_ev_tmline">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_feeder		(1: Feeder event)-->
	<xsl:apply-templates select="e_ev_feeder">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_busbar		(2: Busbar event)-->
	<xsl:apply-templates select="e_ev_busbar">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_trafo		(3: Transformer event)-->
	<xsl:apply-templates select="e_ev_trafo">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_work		(4: Work permit event)-->
	<xsl:apply-templates select="e_ev_work">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_fire		(5: Fire event)-->
	<xsl:apply-templates select="e_ev_fire">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_problem	(6: Equipment problems event)-->
	<xsl:apply-templates select="e_ev_problem">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_staff		(7: Staff / Non-staff visit event)-->
	<xsl:apply-templates select="e_ev_staff">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_outage		(8: Power system outage event)-->
	<xsl:apply-templates select="e_ev_outage">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--e_ev_other		(9: Other event)-->
	<xsl:apply-templates select="e_ev_other">
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		<xsl:with-param name="eventtime"><xsl:value-of select="$eventtime"/></xsl:with-param>
	</xsl:apply-templates>

	<!--supply interruptions-->
	<xsl:apply-templates select="si_list"/>

  	<xsl:variable name="bv6" select="e_d_x_comment"/>
	<xsl:choose><xsl:when test="$bv6">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 10pt"><nobr><b>Remarks</b></nobr></FONT></td>
			</tr>
			<xsl:for-each select="e_d_x_comment/item">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt"><xsl:value-of select="."/></FONT></td>
				</tr>
			</xsl:for-each>
		</table>
		<BR></BR>
	</xsl:when></xsl:choose>

  	<xsl:variable name="bv7" select="e_d_l_document"/>
	<xsl:choose><xsl:when test="$bv7">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 10pt"><nobr><b>Documents</b></nobr></FONT></td>
			</tr>
			<xsl:for-each select="e_d_l_document/doc">
	    		<xsl:variable name="vopt" select="./@type"/>
	    		<xsl:call-template name="test_txt_filetypes">
	        		<xsl:with-param name="list"><xsl:value-of select="$txt_list"/></xsl:with-param>
	        		<xsl:with-param name="ist_typ"><xsl:value-of select="$vopt"/></xsl:with-param>
	        		<xsl:with-param name="cur_name" select="."/>
	        		<xsl:with-param name="cur_desc" select="./@desc"/>
				</xsl:call-template>
				<tr bgcolor="#ffffff"><td>&#160;</td></tr>
			</xsl:for-each>
		</table>
	</xsl:when></xsl:choose>
</xsl:template>

<!--e_ev_undef		(Undefined event)-->
<xsl:template match="e_ev_undef">
	<table border="0">
	</table>
</xsl:template>

<!--e_ev_tmline   	(0: Transmission line event)-->
<xsl:template match="e_ev_tmline">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
  	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt">
				<nobr>&#160;&#160;&#160;&#160;<xsl:copy-of select="$eventtime"/></nobr>
			</FONT></td>
			<td><table border="0">
				<xsl:variable name="e_d_b_rl_rr" select="e_d_b_relais/e_d_b_rl_rr"/>
				<xsl:variable name="e_d_b_rl_rr_off" select="e_d_b_relais/e_d_b_rl_rr_off"/>
				<xsl:variable name="rr_state" select="e_d_b_relais/e_d_e_rl_rr_state/@type"/>
				<xsl:for-each select="e_d_l_breaker/breaker">
					<tr bgcolor="#ffffff">
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
			    		<!--having RR's operating result : show RR's operating result-->
			    		<!--otherwise : show status of CB-->
			    		<xsl:choose><xsl:when test="$e_d_b_rl_rr='1'">
			    			<xsl:choose><xsl:when test="$rr_state">
			    				<xsl:choose><xsl:when test="$e_d_b_rl_rr_off='0'">
										<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="$rr_state"/></nobr></i></FONT></td>
			    				</xsl:when><xsl:otherwise>
			    						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
								</xsl:otherwise></xsl:choose>
			    			</xsl:when><xsl:otherwise>
			    				<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
							</xsl:otherwise></xsl:choose>
			    		</xsl:when><xsl:otherwise>
			    			<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
						</xsl:otherwise></xsl:choose>
    				</tr>
  				</xsl:for-each>
  				<xsl:variable name="bv8" select="e_d_b_relais"/>
				<xsl:choose><xsl:when test="$bv8">
					<xsl:variable name="e_d_b_rl_notshown" select="e_d_b_relais/e_d_b_rl_notshown"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_notshown='0'">
						<xsl:call-template name="distance_relay"></xsl:call-template>
						<xsl:call-template name="oc_relay"></xsl:call-template>
						<xsl:call-template name="ef_relay"></xsl:call-template>
						<xsl:call-template name="currdiff_relay"></xsl:call-template>
			    		<xsl:call-template name="rr_relay">
							<xsl:with-param name="e_d_b_rl_rr"><xsl:value-of select="$e_d_b_rl_rr"/></xsl:with-param>
							<xsl:with-param name="e_d_b_rl_rr_off"><xsl:value-of select="$e_d_b_rl_rr_off"/></xsl:with-param>
			    		</xsl:call-template>
					</xsl:when><xsl:otherwise>
						<xsl:call-template name="relay_not_shown"></xsl:call-template>
					</xsl:otherwise></xsl:choose>
				</xsl:when></xsl:choose>
  			</table></td>
		</tr>
	</table>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--summary of affected from this interr. transmission line (if have)-->
  	<xsl:variable name="bv5" select="e_d_l_affected"/>
	<xsl:choose><xsl:when test="$bv5">
		<table border="0">
			<tr bgcolor="#ffffff">
				<xsl:apply-templates select="e_d_l_line"/>
				<xsl:apply-templates select="e_d_l_affected"/>
			</tr>
		</table>
	</xsl:when></xsl:choose>
	<BR></BR>
	<!--'affected stations' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_sta" select="e_d_l_affected/station_tm"/>
	<xsl:variable name="affected_list_sta" select="substring-after($pre_affected_list_sta, ' ')"/>
	<xsl:variable name="first_sta" select="substring-before($affected_list_sta, ' ')"/>
    <xsl:variable name="remaining_sta" select="substring-after($affected_list_sta, ' ')"/>
	<xsl:call-template name="aff_station_tm_with_switching">
		<xsl:with-param name="affected" select="$first_sta"/>
		<xsl:with-param name="remaining" select="$remaining_sta"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected HV customers' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_cust" select="e_d_l_affected/customer"/>
	<xsl:variable name="affected_list_cust" select="substring-after($pre_affected_list_cust, ' ')"/>
	<xsl:variable name="first_cust" select="substring-before($affected_list_cust, ' ')"/>
    <xsl:variable name="remaining_cust" select="substring-after($affected_list_cust, ' ')"/>
	<xsl:call-template name="aff_customer_with_switching">
		<xsl:with-param name="affected" select="$first_cust"/>
		<xsl:with-param name="remaining" select="$remaining_cust"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected feeders' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_fd" select="e_d_l_affected/feeder"/>
	<xsl:variable name="affected_list_fd" select="substring-after($pre_affected_list_fd, ' ')"/>
	<xsl:variable name="first_fd" select="substring-before($affected_list_fd, ' ')"/>
    <xsl:variable name="remaining_fd" select="substring-after($affected_list_fd, ' ')"/>
	<xsl:call-template name="aff_feeder_with_switching">
		<xsl:with-param name="affected" select="$first_fd"/>
		<xsl:with-param name="remaining" select="$remaining_fd"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!--e_ev_feeder		(1: Feeder event)-->
<xsl:template match="e_ev_feeder">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
  	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt">
				<nobr>&#160;&#160;&#160;&#160;<xsl:copy-of select="$eventtime"/></nobr>
			</FONT></td>
			<td><table border="0">
				<xsl:variable name="e_d_b_rl_rr" select="e_d_b_relais/e_d_b_rl_rr"/>
				<xsl:variable name="e_d_b_rl_rr_off" select="e_d_b_relais/e_d_b_rl_rr_off"/>
				<xsl:variable name="rr_state" select="e_d_b_relais/e_d_e_rl_rr_state/@type"/>
				<xsl:for-each select="e_d_l_breaker/feeder">
					<tr bgcolor="#ffffff">
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
			    		<!--having RR's operating result : show RR's operating result-->
			    		<!--otherwise : show status of CB-->
			    		<xsl:choose><xsl:when test="$e_d_b_rl_rr='1'">
			    			<xsl:choose><xsl:when test="$rr_state!=''">
			    				<xsl:choose><xsl:when test="$e_d_b_rl_rr_off='0'">
										<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="$rr_state"/></nobr></i></FONT></td>
			    				</xsl:when><xsl:otherwise>
			    						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
								</xsl:otherwise></xsl:choose>
			    			</xsl:when><xsl:otherwise>
			    				<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
							</xsl:otherwise></xsl:choose>
			    		</xsl:when><xsl:otherwise>
			    			<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
						</xsl:otherwise></xsl:choose>
    				</tr>
  				</xsl:for-each>
  				<xsl:variable name="bv8" select="e_d_b_relais"/>
				<xsl:choose><xsl:when test="$bv8">
					<xsl:variable name="e_d_b_rl_notshown" select="e_d_b_relais/e_d_b_rl_notshown"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_notshown='0'">
						<xsl:call-template name="oc_relay"></xsl:call-template>
						<xsl:call-template name="ef_relay"></xsl:call-template>
			    		<xsl:call-template name="rr_relay">
							<xsl:with-param name="e_d_b_rl_rr"><xsl:value-of select="$e_d_b_rl_rr"/></xsl:with-param>
							<xsl:with-param name="e_d_b_rl_rr_off"><xsl:value-of select="$e_d_b_rl_rr_off"/></xsl:with-param>
			    		</xsl:call-template>
					</xsl:when><xsl:otherwise>
						<xsl:call-template name="relay_not_shown"></xsl:call-template>
					</xsl:otherwise></xsl:choose>
				</xsl:when></xsl:choose>
  			</table></td>
		</tr>
		<tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt"><nobr>
			&#160;&#160;&#160;&#160;-<xsl:value-of select="e_d_d_loss"/>(<xsl:value-of select="e_d_d_current"/>)
		</nobr></FONT></td></tr>
	</table>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
</xsl:template>

<!--e_ev_busbar		(2: Busbar event)-->
<xsl:template match="e_ev_busbar">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
  	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt">
				<nobr>&#160;&#160;&#160;&#160;<xsl:copy-of select="$eventtime"/></nobr>
			</FONT></td>
			<td><table border="0">
				<xsl:for-each select="e_d_l_breaker/breaker">
					<tr bgcolor="#ffffff">
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
    				</tr>
  				</xsl:for-each>
  				<xsl:variable name="bv8" select="e_d_b_relais"/>
				<xsl:choose><xsl:when test="$bv8">
					<xsl:variable name="e_d_b_rl_notshown" select="e_d_b_relais/e_d_b_rl_notshown"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_notshown='0'">
						<xsl:call-template name="bus_dif_relay"></xsl:call-template>
						<xsl:call-template name="breaker_fail"></xsl:call-template>
						<xsl:call-template name="oc_relay"></xsl:call-template>
						<xsl:call-template name="ef_relay"></xsl:call-template>
						<xsl:call-template name="ouv_relay"></xsl:call-template>
					</xsl:when><xsl:otherwise>
						<xsl:call-template name="relay_not_shown"></xsl:call-template>
					</xsl:otherwise></xsl:choose>
				</xsl:when></xsl:choose>
  			</table></td>
		</tr>
	</table>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--summary of affected from this interr. transmission line (if have)-->
  	<xsl:variable name="bv5" select="e_d_l_affected"/>
	<xsl:choose><xsl:when test="$bv5">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Affects to</nobr></FONT></td>
				<xsl:apply-templates select="e_d_l_affected"/>
			</tr>
		</table>
	</xsl:when></xsl:choose>
	<BR></BR>
	<!--'affected stations' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_sta" select="e_d_l_affected/station"/>
	<xsl:variable name="affected_list_sta" select="substring-after($pre_affected_list_sta, ' ')"/>
	<xsl:variable name="first_sta" select="substring-before($affected_list_sta, ' ')"/>
    <xsl:variable name="remaining_sta" select="substring-after($affected_list_sta, ' ')"/>
	<xsl:call-template name="aff_station_with_switching">
		<xsl:with-param name="affected" select="$first_sta"/>
		<xsl:with-param name="remaining" select="$remaining_sta"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected HV customers' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_cust" select="e_d_l_affected/customer"/>
	<xsl:variable name="affected_list_cust" select="substring-after($pre_affected_list_cust, ' ')"/>
	<xsl:variable name="first_cust" select="substring-before($affected_list_cust, ' ')"/>
    <xsl:variable name="remaining_cust" select="substring-after($affected_list_cust, ' ')"/>
	<xsl:call-template name="aff_customer_with_switching">
		<xsl:with-param name="affected" select="$first_cust"/>
		<xsl:with-param name="remaining" select="$remaining_cust"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected feeders' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_fd" select="e_d_l_affected/feeder"/>
	<xsl:variable name="affected_list_fd" select="substring-after($pre_affected_list_fd, ' ')"/>
	<xsl:variable name="first_fd" select="substring-before($affected_list_fd, ' ')"/>
    <xsl:variable name="remaining_fd" select="substring-after($affected_list_fd, ' ')"/>
	<xsl:call-template name="aff_feeder_with_switching">
		<xsl:with-param name="affected" select="$first_fd"/>
		<xsl:with-param name="remaining" select="$remaining_fd"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!--e_ev_trafo		(3: Transformer event)-->
<xsl:template match="e_ev_trafo">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
  	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt">
				<nobr>&#160;&#160;&#160;&#160;<xsl:copy-of select="$eventtime"/></nobr>
			</FONT></td>
			<td><table border="0">
				<xsl:for-each select="e_d_l_breaker/breaker">
					<tr bgcolor="#ffffff">
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
			    		<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@status"/></nobr></FONT></td>
    				</tr>
  				</xsl:for-each>
  				<xsl:variable name="bv8" select="e_d_b_relais"/>
				<xsl:choose><xsl:when test="$bv8">
					<xsl:variable name="e_d_b_rl_notshown" select="e_d_b_relais/e_d_b_rl_notshown"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_notshown='0'">
						<xsl:call-template name="transf_dif_relay"></xsl:call-template>
						<xsl:call-template name="buchholz"></xsl:call-template>
						<xsl:call-template name="sudden_gas"></xsl:call-template>
						<xsl:call-template name="backup"></xsl:call-template>
						<xsl:call-template name="oc_relay"></xsl:call-template>
						<xsl:call-template name="ef_relay"></xsl:call-template>
						<xsl:call-template name="ouv_relay"></xsl:call-template>
					</xsl:when><xsl:otherwise>
						<xsl:call-template name="relay_not_shown"></xsl:call-template>
					</xsl:otherwise></xsl:choose>
				</xsl:when></xsl:choose>
  			</table></td>
		</tr>
	</table>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--summary of affected from this interr. transmission line (if have)-->
  	<xsl:variable name="bv5" select="e_d_l_affected"/>
	<xsl:choose><xsl:when test="$bv5">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>Affects to</nobr></FONT></td>
				<xsl:apply-templates select="e_d_l_affected"/>
			</tr>
		</table>
	</xsl:when></xsl:choose>
	<BR></BR>
	<!--'affected stations' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_sta" select="e_d_l_affected/station_tr"/>
	<xsl:variable name="affected_list_sta" select="substring-after($pre_affected_list_sta, ' ')"/>
	<xsl:variable name="first_sta" select="substring-before($affected_list_sta, ' ')"/>
    <xsl:variable name="remaining_sta" select="substring-after($affected_list_sta, ' ')"/>
	<xsl:call-template name="aff_station_tr_with_switching">
		<xsl:with-param name="affected" select="$first_sta"/>
		<xsl:with-param name="remaining" select="$remaining_sta"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected HV customers' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_cust" select="e_d_l_affected/customer"/>
	<xsl:variable name="affected_list_cust" select="substring-after($pre_affected_list_cust, ' ')"/>
	<xsl:variable name="first_cust" select="substring-before($affected_list_cust, ' ')"/>
    <xsl:variable name="remaining_cust" select="substring-after($affected_list_cust, ' ')"/>
	<xsl:call-template name="aff_customer_with_switching">
		<xsl:with-param name="affected" select="$first_cust"/>
		<xsl:with-param name="remaining" select="$remaining_cust"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected feeders' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_fd" select="e_d_l_affected/feeder"/>
	<xsl:variable name="affected_list_fd" select="substring-after($pre_affected_list_fd, ' ')"/>
	<xsl:variable name="first_fd" select="substring-before($affected_list_fd, ' ')"/>
    <xsl:variable name="remaining_fd" select="substring-after($affected_list_fd, ' ')"/>
	<xsl:call-template name="aff_feeder_with_switching">
		<xsl:with-param name="affected" select="$first_fd"/>
		<xsl:with-param name="remaining" select="$remaining_fd"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!--e_ev_work		(4: Work permit event)-->
<xsl:template match="e_ev_work">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<table border="0">
		<tr bgcolor="#ffffff">
  			<xsl:variable name="e_d_e_wp_type" select="e_d_e_wp_type"/>
			<xsl:choose><xsl:when test="$e_d_e_wp_type='0'">
				<td><FONT face="tohoma" style="font-size: 9pt"><b><nobr>No W/P</nobr></b></FONT></td>
			</xsl:when><xsl:when test="$e_d_e_wp_type='1'">
				<td><FONT face="tohoma" style="font-size: 9pt"><b><nobr>W/P</nobr></b></FONT></td>
			</xsl:when></xsl:choose>
			<td><FONT face="tohoma" style="font-size: 9pt"><b><nobr><xsl:value-of select="e_d_e_wp_respon/@type"/></nobr></b></FONT></td>
  			<xsl:variable name="e_d_e_wp_switch" select="e_d_e_wp_switch"/>
			<xsl:choose><xsl:when test="$e_d_e_wp_switch='0'">
				<td><FONT face="tohoma" style="font-size: 9pt"><b><nobr>(Without switching)</nobr></b></FONT></td>
			</xsl:when><xsl:when test="$e_d_e_wp_switch='1'">
				<td><FONT face="tohoma" style="font-size: 9pt"><b><nobr>(With switching)</nobr></b></FONT></td>
			</xsl:when></xsl:choose>
		</tr>
	</table>
	<BR></BR>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
	<xsl:variable name="e_d_l_line" select="e_d_l_line"/>
	<xsl:choose><xsl:when test="$e_d_l_line">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Transmission line </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_line/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<xsl:variable name="e_d_l_feeder" select="e_d_l_feeder"/>
	<xsl:choose><xsl:when test="$e_d_l_feeder">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Feeder </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_feeder/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
</xsl:template>

<!--e_ev_fire		(5: Fire event)-->
<xsl:template match="e_ev_fire">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
	<table border="0">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:copy-of select="$eventtime"/></nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Duration of fire "<xsl:value-of select="e_d_d_duration/@hhmm"/>"</nobr></i></FONT></td>
		</tr>
	</table>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
</xsl:template>

<!--e_ev_problem	(6: Equipment problems event)-->
<xsl:template match="e_ev_problem">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
	<xsl:variable name="e_d_l_line" select="e_d_l_line"/>
	<xsl:choose><xsl:when test="$e_d_l_line">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Transmission line </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_line/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<xsl:variable name="e_d_l_feeder" select="e_d_l_feeder"/>
	<xsl:choose><xsl:when test="$e_d_l_feeder">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Feeder </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_feeder/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
</xsl:template>

<!--e_ev_staff		(7: Staff / Non-staff visit event)-->
<xsl:template match="e_ev_staff">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
	<table border="0">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:copy-of select="$eventtime"/></nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Visited by "<xsl:value-of select="e_d_e_vi_type/@type"/>"</nobr></i></FONT></td>
		</tr>
	</table>
	<BR></BR>
</xsl:template>

<!--e_ev_outage		(8: Power system outage event)-->
<xsl:template match="e_ev_outage">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt"><u><nobr>Power system outage</nobr></u></FONT></td>
		</tr>
	</table>
  	<table border="0">
		<tr bgcolor="#ffffff">
			<td valign="TOP"><FONT face="tohoma" style="font-size: 9pt">
				<nobr>&#160;&#160;&#160;&#160;<xsl:copy-of select="$eventtime"/></nobr>
			</FONT></td>
			<xsl:variable name="e_d_b_eg_lo" select="e_d_b_eg_lo"/>
			<xsl:variable name="e_d_b_eg_uf" select="e_d_b_eg_uf"/>
			<xsl:variable name="summing" select="$e_d_b_eg_lo + $e_d_b_eg_uf"/>
			<xsl:if test="$summing &gt; 1">
				<td><FONT face="tohoma" style="font-size: 9pt"><nobr>EGAT
					<xsl:if test="$e_d_b_eg_lo">&#160;(Load shedding)</xsl:if>
					<xsl:if test="$e_d_b_eg_uf">&#160;(UF relay)</xsl:if>
				</nobr></FONT></td>
			</xsl:if>
			<xsl:for-each select="e_d_l_station/station">
			    <td><FONT face="tohoma" style="font-size: 9pt"><nobr>Station <xsl:value-of select="."/> (<xsl:value-of select="./@status"/>)</nobr></FONT></td>
  			</xsl:for-each>
  			<xsl:for-each select="e_d_l_customer/item">
			    <td><FONT face="tohoma" style="font-size: 9pt"><nobr>HV customer <xsl:value-of select="."/></nobr></FONT></td>
  			</xsl:for-each>
  			<xsl:for-each select="e_d_l_line/item">
			    <td><FONT face="tohoma" style="font-size: 9pt"><nobr>Transmission line <xsl:value-of select="."/></nobr></FONT></td>
  			</xsl:for-each>
  			<td><FONT face="tohoma" style="font-size: 9pt"><nobr>, affects to</nobr></FONT></td>
		</tr>
	</table>
	<BR></BR>
	<!--'affected stations' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_sta" select="e_d_l_affected/station"/>
	<xsl:variable name="affected_list_sta" select="substring-after($pre_affected_list_sta, ' ')"/>
	<xsl:variable name="first_sta" select="substring-before($affected_list_sta, ' ')"/>
    <xsl:variable name="remaining_sta" select="substring-after($affected_list_sta, ' ')"/>
	<xsl:call-template name="aff_station_with_switching">
		<xsl:with-param name="affected" select="$first_sta"/>
		<xsl:with-param name="remaining" select="$remaining_sta"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected HV customers' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_cust" select="e_d_l_affected/customer"/>
	<xsl:variable name="affected_list_cust" select="substring-after($pre_affected_list_cust, ' ')"/>
	<xsl:variable name="first_cust" select="substring-before($affected_list_cust, ' ')"/>
    <xsl:variable name="remaining_cust" select="substring-after($affected_list_cust, ' ')"/>
	<xsl:call-template name="aff_customer_with_switching">
		<xsl:with-param name="affected" select="$first_cust"/>
		<xsl:with-param name="remaining" select="$remaining_cust"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
  	<!--'affected feeders' with their 'switching orders'-->
	<xsl:variable name="pre_affected_list_fd" select="e_d_l_affected/feeder"/>
	<xsl:variable name="affected_list_fd" select="substring-after($pre_affected_list_fd, ' ')"/>
	<xsl:variable name="first_fd" select="substring-before($affected_list_fd, ' ')"/>
    <xsl:variable name="remaining_fd" select="substring-after($affected_list_fd, ' ')"/>
	<xsl:call-template name="aff_feeder_with_switching">
		<xsl:with-param name="affected" select="$first_fd"/>
		<xsl:with-param name="remaining" select="$remaining_fd"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!--e_ev_other		(9: Other event)-->
<xsl:template match="e_ev_other">
	<xsl:param name="eventdate"/>
	<xsl:param name="eventtime"/>
	<xsl:call-template name="e_d_l_station"></xsl:call-template>
	<xsl:variable name="e_d_l_line" select="e_d_l_line"/>
	<xsl:choose><xsl:when test="$e_d_l_line">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Transmission line </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_line/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<xsl:variable name="e_d_l_feeder" select="e_d_l_feeder"/>
	<xsl:choose><xsl:when test="$e_d_l_feeder">
		<table border="0">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Feeder </nobr></i></FONT></td>
				<xsl:for-each select="e_d_l_feeder/item">
			    	<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="."/>&#160;</nobr></i></FONT></td>
  				</xsl:for-each>
  			</tr>
		</table>
	</xsl:when></xsl:choose>
	<!--'switching order' belonging to stations-->
	<xsl:call-template name="e_d_l_equipment">
		<xsl:with-param name="for_aftype" select="0"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
</xsl:template>


<!--stations-->
<xsl:template name="e_d_l_station">
	<table border="0">
  		<xsl:for-each select="e_d_l_station/station">
			<tr bgcolor="#ffffff">
			    <td><FONT face="tohoma" style="font-size: 9pt"><nobr><U>Station <xsl:value-of select="."/></U> (<xsl:value-of select="./@status"/>)</nobr></FONT></td>
    		</tr>
  		</xsl:for-each>
  	</table>
</xsl:template>

<!--recloser relay-->
<xsl:template name="rr_relay">
	<xsl:param name="e_d_b_rl_rr"/>
	<xsl:param name="e_d_b_rl_rr_off"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_rr_off='0'">
		<xsl:choose><xsl:when test="$e_d_b_rl_rr='1'">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>RR</nobr></i></FONT></td>
		</xsl:when></xsl:choose>
	</xsl:when><xsl:otherwise>
		<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Off RR</nobr></i></FONT></td>
	</xsl:otherwise></xsl:choose>
</xsl:template>

<!--relay not shown-->
<xsl:template name="relay_not_shown">
	<tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>RELAY NOT SHOWN</nobr></i></FONT></td></tr>
</xsl:template>

<!--Bus differential relay-->
<xsl:template name="bus_dif_relay">
	<xsl:variable name="e_d_b_rl_df" select="e_d_b_relais/e_d_b_rl_df"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_df='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
				BusDiff-
				<xsl:variable name="e_d_b_rl_df_phase_r" select="e_d_b_relais/e_d_b_rl_df_phase_r"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_r='1'">R</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_df_phase_y" select="e_d_b_relais/e_d_b_rl_df_phase_y"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_y='1'">Y</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_df_phase_b" select="e_d_b_relais/e_d_b_rl_df_phase_b"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_b='1'">B</xsl:when></xsl:choose>
			</nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--Transformer differential relay-->
<xsl:template name="transf_dif_relay">
	<xsl:variable name="e_d_b_rl_df" select="e_d_b_relais/e_d_b_rl_df"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_df='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
				TransfDiff-
				<xsl:variable name="e_d_b_rl_df_phase_r" select="e_d_b_relais/e_d_b_rl_df_phase_r"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_r='1'">R</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_df_phase_y" select="e_d_b_relais/e_d_b_rl_df_phase_y"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_y='1'">Y</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_df_phase_b" select="e_d_b_relais/e_d_b_rl_df_phase_b"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_df_phase_b='1'">B</xsl:when></xsl:choose>
			</nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--Breaker fail-->
<xsl:template name="breaker_fail">
	<xsl:variable name="e_d_b_rl_lb" select="e_d_b_relais/e_d_b_rl_lb"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_lb='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Breaker fail</nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Status = <xsl:value-of select="e_d_b_relais/e_d_e_rl_lb_prot/@type"/></nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--distance relay-->
<xsl:template name="distance_relay">
	<xsl:variable name="e_d_b_rl_dr" select="e_d_b_relais/e_d_b_rl_dr"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_dr='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
				DIST-
				<xsl:variable name="e_d_b_rl_dr_phase_r" select="e_d_b_relais/e_d_b_rl_dr_phase_r"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_dr_phase_r='1'">R</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_dr_phase_y" select="e_d_b_relais/e_d_b_rl_dr_phase_y"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_dr_phase_y='1'">Y</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_dr_phase_b" select="e_d_b_relais/e_d_b_rl_dr_phase_b"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_dr_phase_b='1'">B</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_dr_phase_g" select="e_d_b_relais/e_d_b_rl_dr_phase_g"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_dr_phase_g='1'">G</xsl:when></xsl:choose>
			</nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
				(Zone = 
				<xsl:variable name="e_d_e_rl_dr_zone" select="e_d_b_relais/e_d_e_rl_dr_zone"/>
				<xsl:choose><xsl:when test="$e_d_e_rl_dr_zone='0'">Not shown</xsl:when>
				<xsl:otherwise><xsl:value-of select="$e_d_e_rl_dr_zone"/></xsl:otherwise></xsl:choose>)
			</nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr><xsl:value-of select="e_d_b_relais/e_d_d_rl_dr_dist"/> km.</nobr></i></FONT></td>
    	</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--overcurrent relay-->
<xsl:template name="oc_relay">
	<xsl:variable name="e_d_b_rl_oc" select="e_d_b_relais/e_d_b_rl_oc"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_oc='1'">
		<xsl:variable name="e_d_b_rl_oc_dir" select="e_d_b_relais/e_d_b_rl_oc_dir"/>
		<xsl:variable name="e_d_b_rl_oc_inst" select="e_d_b_relais/e_d_b_rl_oc_inst"/>
		<xsl:variable name="e_d_b_rl_oc_delay" select="e_d_b_relais/e_d_b_rl_oc_delay"/>
		<xsl:choose><xsl:when test="$e_d_b_rl_oc_inst='1'">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_dir='1'">
						DOC-I-
					</xsl:when><xsl:otherwise>
						OC-I-
					</xsl:otherwise></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_phase_r" select="e_d_b_relais/e_d_b_rl_oc_phase_r"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_phase_r='1'">R</xsl:when></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_phase_y" select="e_d_b_relais/e_d_b_rl_oc_phase_y"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_phase_y='1'">Y</xsl:when></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_phase_b" select="e_d_b_relais/e_d_b_rl_oc_phase_b"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_phase_b='1'">B</xsl:when></xsl:choose>
				</nobr></i></FONT></td>
			</tr>
		</xsl:when></xsl:choose>
		<xsl:choose><xsl:when test="$e_d_b_rl_oc_delay='1'">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_dir='1'">
						DOC-T-
					</xsl:when><xsl:otherwise>
						OC-T-
					</xsl:otherwise></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_tphase_r" select="e_d_b_relais/e_d_b_rl_oc_tphase_r"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_r='1'">R</xsl:when></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_tphase_y" select="e_d_b_relais/e_d_b_rl_oc_tphase_y"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_y='1'">Y</xsl:when></xsl:choose>
					<xsl:variable name="e_d_b_rl_oc_tphase_b" select="e_d_b_relais/e_d_b_rl_oc_tphase_b"/>
					<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_b='1'">B</xsl:when></xsl:choose>
				</nobr></i></FONT></td>
			</tr>
		</xsl:when></xsl:choose>
		<xsl:choose><xsl:when test="$e_d_b_rl_oc_inst='0'">
			<xsl:choose><xsl:when test="$e_d_b_rl_oc_delay='0'">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
						<xsl:choose><xsl:when test="$e_d_b_rl_oc_dir='1'">
							DOC-
						</xsl:when><xsl:otherwise>
							OC-
						</xsl:otherwise></xsl:choose>
						<xsl:variable name="e_d_b_rl_oc_tphase_r" select="e_d_b_relais/e_d_b_rl_oc_phase_r"/>
						<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_r='1'">R</xsl:when></xsl:choose>
						<xsl:variable name="e_d_b_rl_oc_tphase_y" select="e_d_b_relais/e_d_b_rl_oc_phase_y"/>
						<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_y='1'">Y</xsl:when></xsl:choose>
						<xsl:variable name="e_d_b_rl_oc_tphase_b" select="e_d_b_relais/e_d_b_rl_oc_phase_b"/>
						<xsl:choose><xsl:when test="$e_d_b_rl_oc_tphase_b='1'">B</xsl:when></xsl:choose>
					</nobr></i></FONT></td>
				</tr>
			</xsl:when></xsl:choose>
		</xsl:when></xsl:choose>
	</xsl:when></xsl:choose>
</xsl:template>

<!--earth fault relay-->
<xsl:template name="ef_relay">
	<xsl:variable name="e_d_b_rl_ef" select="e_d_b_relais/e_d_b_rl_ef"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_ef='1'">
		<xsl:variable name="e_d_b_rl_ef_dir" select="e_d_b_relais/e_d_b_rl_ef_dir"/>
		<xsl:variable name="e_d_b_rl_ef_inst" select="e_d_b_relais/e_d_b_rl_ef_inst"/>
		<xsl:variable name="e_d_b_rl_ef_delay" select="e_d_b_relais/e_d_b_rl_ef_delay"/>
		<xsl:choose><xsl:when test="$e_d_b_rl_ef_inst='1'">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
					<xsl:choose><xsl:when test="$e_d_b_rl_ef_dir='1'">
						DEF-I
					</xsl:when><xsl:otherwise>
						EF-I
					</xsl:otherwise></xsl:choose>
				</nobr></i></FONT></td>
			</tr>
		</xsl:when></xsl:choose>
		<xsl:choose><xsl:when test="$e_d_b_rl_ef_delay='1'">
			<tr bgcolor="#ffffff">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
					<xsl:choose><xsl:when test="$e_d_b_rl_ef_dir='1'">
						DEF-T
					</xsl:when><xsl:otherwise>
						EF-T
					</xsl:otherwise></xsl:choose>
				</nobr></i></FONT></td>
			</tr>
		</xsl:when></xsl:choose>
		<xsl:choose><xsl:when test="$e_d_b_rl_ef_inst='0'">
			<xsl:choose><xsl:when test="$e_d_b_rl_ef_delay='0'">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
						<xsl:choose><xsl:when test="$e_d_b_rl_ef_dir='1'">
							DEF
						</xsl:when><xsl:otherwise>
							EF
						</xsl:otherwise></xsl:choose>
					</nobr></i></FONT></td>
				</tr>
			</xsl:when></xsl:choose>
		</xsl:when></xsl:choose>
	</xsl:when></xsl:choose>
</xsl:template>

<!--current differential relay-->
<xsl:template name="currdiff_relay">
	<xsl:variable name="e_d_b_rl_cu" select="e_d_b_relais/e_d_b_rl_cu"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_cu='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
				CurrDiff-
				<xsl:variable name="e_d_b_rl_cu_phase_r" select="e_d_b_relais/e_d_b_rl_cu_phase_r"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_cu_phase_r='1'">R</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_cu_phase_y" select="e_d_b_relais/e_d_b_rl_cu_phase_y"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_cu_phase_y='1'">Y</xsl:when></xsl:choose>
				<xsl:variable name="e_d_b_rl_cu_phase_b" select="e_d_b_relais/e_d_b_rl_cu_phase_b"/>
				<xsl:choose><xsl:when test="$e_d_b_rl_cu_phase_b='1'">B</xsl:when></xsl:choose>
			</nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--over/under voltage relay-->
<xsl:template name="ouv_relay">
	<xsl:variable name="e_d_b_rl_ou" select="e_d_b_relais/e_d_b_rl_ou"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_ou='1'">
		<tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>
			<xsl:value-of select="e_d_b_relais/e_d_e_rl_ou_kind/@type"/> relay
		</nobr></i></FONT></td></tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--buchholz relay-->
<xsl:template name="buchholz">
	<xsl:variable name="e_d_b_rl_bu" select="e_d_b_relais/e_d_b_rl_bu"/>
	<xsl:variable name="e_d_b_rl_bu_lo" select="e_d_b_relais/e_d_b_rl_bu_lo"/>
	<xsl:variable name="e_d_b_rl_bu_tr" select="e_d_b_relais/e_d_b_rl_bu_tr"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_bu='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Buchholz relay</nobr></i></FONT></td>
			<xsl:if test="$e_d_b_rl_bu_lo='1'">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>On-load tap</nobr></i></FONT></td>
			</xsl:if>
			<xsl:if test="$e_d_b_rl_bu_tr='1'">
				<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Transformer</nobr></i></FONT></td>
			</xsl:if>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--sudden gas-->
<xsl:template name="sudden_gas">
	<xsl:variable name="e_d_b_rl_su" select="e_d_b_relais/e_d_b_rl_su"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_su='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Sudden gas</nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--back up-->
<xsl:template name="backup">
	<xsl:variable name="e_d_b_rl_bc" select="e_d_b_relais/e_d_b_rl_bc"/>
	<xsl:choose><xsl:when test="$e_d_b_rl_bc='1'">
		<tr bgcolor="#ffffff">
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Back up</nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>Resupply time</nobr></i></FONT></td>
			<td><FONT face="tohoma" style="font-size: 9pt"><i><nobr>"<xsl:value-of select="e_d_b_relais/e_d_v_rl_bc_dati/@time_loc"/>"</nobr></i></FONT></td>
		</tr>
	</xsl:when></xsl:choose>
</xsl:template>

<!--transmission line-->
<xsl:template match="e_d_l_line">
	<td><FONT face="tohoma" style="font-size: 9pt"><nobr>At that time, transmission line
  		<xsl:for-each select="./item">
		 	&#160;<xsl:value-of select="."/>
		</xsl:for-each>
		&#160;energize(s) load at
	</nobr></FONT></td>
</xsl:template>

<!--e_d_l_affected (Affected "station, HV customers, feeder")-->
<xsl:template match="e_d_l_affected">
	<xsl:for-each select="station_tm">
		<td><FONT face="tohoma" style="font-size: 9pt"> station&#160;<xsl:value-of select="."/></FONT></td>
	</xsl:for-each>
	<xsl:for-each select="station_tr">
		<td><FONT face="tohoma" style="font-size: 9pt"> station&#160;<xsl:value-of select="."/></FONT></td>
	</xsl:for-each>
	<xsl:for-each select="station">
		<td><FONT face="tohoma" style="font-size: 9pt"> station&#160;<xsl:value-of select="."/></FONT></td>
	</xsl:for-each>
	<xsl:for-each select="customer">
		<td><FONT face="tohoma" style="font-size: 9pt"> HV customer&#160;<xsl:value-of select="."/></FONT></td>
	</xsl:for-each>
	<xsl:for-each select="feeder">
		<td><FONT face="tohoma" style="font-size: 9pt"> feeder&#160;<xsl:value-of select="."/></FONT></td>
	</xsl:for-each>
	<td><FONT face="tohoma" style="font-size: 9pt"><nobr>, leads to</nobr></FONT></td>
</xsl:template>

<!--'affected station' and 'switching order' of 'transmission line' event-->
<xsl:template name="aff_station_tm_with_switching">
	<xsl:param name="affected"/>
	<xsl:param name="remaining"/>
	<xsl:param name="eventdate"/>
	<xsl:call-template name="aff_station_tm">
		<xsl:with-param name="affected" select="$affected"/>
	</xsl:call-template>
	<xsl:call-template name="switching_of_affected">
		<xsl:with-param name="affected" select="$affected"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
	<xsl:if test="$remaining">
		<xsl:variable name="next_first" select="substring-before($remaining, ' ')"/>
    	<xsl:variable name="next_remaining" select="substring-after($remaining, ' ')"/>
		<xsl:call-template name="aff_station_tm_with_switching">
			<xsl:with-param name="affected" select="$next_first"/>
			<xsl:with-param name="remaining" select="$next_remaining"/>
			<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!--'affected station' of 'transmission line' event-->
<xsl:template name="aff_station_tm">
	<xsl:param name="affected"/>
  	<xsl:for-each select="e_d_l_affected/station_tm/object">
  		<xsl:variable name="station_tm" select="."/>
  		<xsl:if test="$affected=$station_tm">
  			<table border="0">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt">
						<nobr><U>Affected station <xsl:value-of select="$station_tm"/></U></nobr>
						<nobr> [ "<xsl:value-of select="./@btime_loc"/>"</nobr>
						<nobr> Until "<xsl:value-of select="./@etime_loc"/>",</nobr>
						<xsl:if test="./@cto='Yes'"><nobr> CTO "<xsl:value-of select="./@cto_dur"/> sec. -> <xsl:value-of select="./@cto_sta"/>",</nobr></xsl:if>
						<xsl:if test="./@lcto='Yes'"><nobr> LCTO "<xsl:value-of select="./@lcto_dur"/> sec. -> <xsl:value-of select="./@lcto_sta"/>",</nobr></xsl:if>
						<xsl:if test="./@ltf='Yes'"><nobr> LTF "<xsl:value-of select="./@ltf_dur"/> sec. -> <xsl:value-of select="./@ltf_sta"/>",</nobr></xsl:if>
						<xsl:if test="./@lto='Yes'"><nobr> LTO "<xsl:value-of select="./@lto_dur"/> sec. -> <xsl:value-of select="./@lto_sta"/>",</nobr></xsl:if>
						<xsl:if test="./@xto='Yes'"><nobr>&#160;<xsl:value-of select="./@xto_other"/> "<xsl:value-of select="./@xto_dur"/> sec. -> <xsl:value-of select="./@xto_sta"/>",</nobr></xsl:if>
						<nobr> (<xsl:value-of select="./@details"/>) ]</nobr>
					</FONT></td>
    			</tr>
    		</table>
    	</xsl:if>
  	</xsl:for-each>
</xsl:template>

<!--'affected station' and 'switching order' of 'transformer' event-->
<xsl:template name="aff_station_tr_with_switching">
	<xsl:param name="affected"/>
	<xsl:param name="remaining"/>
	<xsl:param name="eventdate"/>
	<xsl:call-template name="aff_station_tr">
		<xsl:with-param name="affected" select="$affected"/>
	</xsl:call-template>
	<xsl:call-template name="switching_of_affected">
		<xsl:with-param name="affected" select="$affected"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
	<xsl:if test="$remaining">
		<xsl:variable name="next_first" select="substring-before($remaining, ' ')"/>
    	<xsl:variable name="next_remaining" select="substring-after($remaining, ' ')"/>
		<xsl:call-template name="aff_station_tm_with_switching">
			<xsl:with-param name="affected" select="$next_first"/>
			<xsl:with-param name="remaining" select="$next_remaining"/>
			<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!--'affected station' of 'transformer' event-->
<xsl:template name="aff_station_tr">
	<xsl:param name="affected"/>
  	<xsl:for-each select="e_d_l_affected/station_tr/object">
  		<xsl:variable name="station_tr" select="."/>
  		<xsl:if test="$affected=$station_tr">
  			<table border="0">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt">
						<nobr><U>Affected station <xsl:value-of select="$station_tr"/></U></nobr>
						<nobr> [ "<xsl:value-of select="./@btime_loc"/>"</nobr>
						<nobr> Until "<xsl:value-of select="./@etime_loc"/>",</nobr>
						<xsl:if test="./@bto='Yes'"><nobr> BTO "<xsl:value-of select="./@bto_dur"/> sec. -> <xsl:value-of select="./@bto_sta"/>",</nobr></xsl:if>
						<xsl:if test="./@xto='Yes'"><nobr>&#160;<xsl:value-of select="./@xto_other"/> "<xsl:value-of select="./@xto_dur"/> sec. -> <xsl:value-of select="./@xto_sta"/>",</nobr></xsl:if>
						<nobr> (<xsl:value-of select="./@details"/>) ]</nobr>
					</FONT></td>
    			</tr>
    		</table>
    	</xsl:if>
  	</xsl:for-each>
</xsl:template>

<!--'affected station' and 'switching order' of 'power system outage' event and 'busbar' event-->
<xsl:template name="aff_station_with_switching">
	<xsl:param name="affected"/>
	<xsl:param name="remaining"/>
	<xsl:param name="eventdate"/>
	<xsl:call-template name="aff_station">
		<xsl:with-param name="affected" select="$affected"/>
	</xsl:call-template>
	<xsl:call-template name="switching_of_affected">
		<xsl:with-param name="affected" select="$affected"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
	<xsl:if test="$remaining">
		<xsl:variable name="next_first" select="substring-before($remaining, ' ')"/>
    	<xsl:variable name="next_remaining" select="substring-after($remaining, ' ')"/>
		<xsl:call-template name="aff_station_with_switching">
			<xsl:with-param name="affected" select="$next_first"/>
			<xsl:with-param name="remaining" select="$next_remaining"/>
			<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!--'affected station' of 'power system outage' event and 'busbar' event-->
<xsl:template name="aff_station">
	<xsl:param name="affected"/>
  	<xsl:for-each select="e_d_l_affected/station/object">
  		<xsl:variable name="station" select="."/>
  		<xsl:if test="$affected=$station">
  			<table border="0">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt">
						<nobr><U>Affected station <xsl:value-of select="$station"/></U></nobr>
						<nobr> [ "<xsl:value-of select="./@btime_loc"/>"</nobr>
						<nobr> Until "<xsl:value-of select="./@etime_loc"/>",</nobr>
						<nobr> (<xsl:value-of select="./@details"/>) ]</nobr>
					</FONT></td>
    			</tr>
    		</table>
    	</xsl:if>
  	</xsl:for-each>
</xsl:template>

<!--'affected customer' and 'switching order'-->
<xsl:template name="aff_customer_with_switching">
	<xsl:param name="affected"/>
	<xsl:param name="remaining"/>
	<xsl:param name="eventdate"/>
	<xsl:call-template name="aff_customer">
		<xsl:with-param name="affected" select="$affected"/>
	</xsl:call-template>
	<xsl:call-template name="switching_of_affected">
		<xsl:with-param name="affected" select="$affected"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
	<xsl:if test="$remaining">
		<xsl:variable name="next_first" select="substring-before($remaining, ' ')"/>
    	<xsl:variable name="next_remaining" select="substring-after($remaining, ' ')"/>
		<xsl:call-template name="aff_customer_with_switching">
			<xsl:with-param name="affected" select="$next_first"/>
			<xsl:with-param name="remaining" select="$next_remaining"/>
			<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!--'affected customer'-->
<xsl:template name="aff_customer">
	<xsl:param name="affected"/>
  	<xsl:for-each select="e_d_l_affected/customer/object">
  		<xsl:variable name="customer" select="."/>
  		<xsl:if test="$affected=$customer">
  			<table border="0">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt">
						<nobr><U>Affected HV customer <xsl:value-of select="$customer"/></U></nobr>
						<nobr> [ "<xsl:value-of select="./@btime_loc"/>"</nobr>
						<nobr> Until "<xsl:value-of select="./@etime_loc"/>",</nobr>
						<nobr> (<xsl:value-of select="./@details"/>) ]</nobr>
					</FONT></td>
    			</tr>
    		</table>
    	</xsl:if>
  	</xsl:for-each>
</xsl:template>

<!--'affected feeder' and 'switching order'-->
<xsl:template name="aff_feeder_with_switching">
	<xsl:param name="affected"/>
	<xsl:param name="remaining"/>
	<xsl:param name="eventdate"/>
	<xsl:call-template name="aff_feeder">
		<xsl:with-param name="affected" select="$affected"/>
	</xsl:call-template>
	<xsl:call-template name="switching_of_affected">
		<xsl:with-param name="affected" select="$affected"/>
		<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
	</xsl:call-template>
	<BR></BR>
	<xsl:if test="$remaining">
		<xsl:variable name="next_first" select="substring-before($remaining, ' ')"/>
    	<xsl:variable name="next_remaining" select="substring-after($remaining, ' ')"/>
		<xsl:call-template name="aff_feeder_with_switching">
			<xsl:with-param name="affected" select="$next_first"/>
			<xsl:with-param name="remaining" select="$next_remaining"/>
			<xsl:with-param name="eventdate"><xsl:value-of select="$eventdate"/></xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!--'affected feeder'-->
<xsl:template name="aff_feeder">
	<xsl:param name="affected"/>
  	<xsl:for-each select="e_d_l_affected/feeder/object">
  		<xsl:variable name="feeder" select="."/>
  		<xsl:if test="$affected=$feeder">
  			<table border="0">
				<tr bgcolor="#ffffff">
					<td><FONT face="tohoma" style="font-size: 9pt">
						<nobr><U>Affected feeder <xsl:value-of select="$feeder"/></U></nobr>
						<nobr> [ "<xsl:value-of select="./@btime_loc"/>"</nobr>
						<nobr> Until "<xsl:value-of select="./@etime_loc"/>",</nobr>
						<nobr> (<xsl:value-of select="./@details"/>) ]</nobr>
					</FONT></td>
    			</tr>
    		</table>
    	</xsl:if>
  	</xsl:for-each>
</xsl:template>

<!--'switching order' for station-->
<xsl:template name="e_d_l_equipment">
	<xsl:param name="for_aftype"/>
	<xsl:param name="eventdate"/>
	<table border="0">
  		<xsl:for-each select="e_d_l_equipment/equipment">
  			<xsl:variable name="aftype" select="./@aftype"/>
  			<xsl:choose><xsl:when test="$aftype=$for_aftype">
				<tr bgcolor="#ffffff">
					<xsl:variable name="time_loc" select="./@time_loc"/>
					<xsl:variable name="date_time_loc" select="substring-before($time_loc, ' ')"/>
					<xsl:variable name="time_time_loc" select="substring-after($time_loc, ' ')"/>
					<xsl:variable name="status" select="./@status"/>
					<xsl:variable name="remark" select="./@remark"/>
					<xsl:variable name="remark_before" select="substring-before($remark, ' ')"/>
					<xsl:variable name="remark_after" select="substring-after($remark, ' ')"/>
					<xsl:choose><xsl:when test="$date_time_loc=$eventdate">
							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;<xsl:value-of select="$time_time_loc"/></nobr></FONT></td>
					</xsl:when><xsl:otherwise>
							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;<xsl:value-of select="$time_loc"/></nobr></FONT></td>
					</xsl:otherwise></xsl:choose>
      				<xsl:choose><xsl:when test="$status='Open'">
      					<xsl:choose><xsl:when test="$remark_before='ตก'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ตก</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:when test="$remark_before='ไม่ตก'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ไม่ตก</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
						</xsl:when><xsl:when test="$remark_before='ตกสับติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ตกสับติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:otherwise>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;Open</nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      					</xsl:otherwise></xsl:choose>
      				</xsl:when><xsl:when test="$status='Close'">
      					<xsl:choose><xsl:when test="$remark_before='สับติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สับติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:when test="$remark_before='สับไม่ติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สับไม่ติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
						</xsl:when><xsl:otherwise>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;Close</nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      					</xsl:otherwise></xsl:choose>
 					</xsl:when><xsl:otherwise>
 						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$status"/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      				</xsl:otherwise></xsl:choose>
    			</tr>
			</xsl:when></xsl:choose>
  		</xsl:for-each>
	</table>
</xsl:template>

<!--'switching order' for affected-->
<xsl:template name="switching_of_affected">
	<xsl:param name="affected"/>
	<xsl:param name="eventdate"/>
	<table border="0">
  		<xsl:for-each select="e_d_l_equipment/equipment">
  			<xsl:variable name="affected_equipment" select="./@affected"/>
  			<xsl:choose><xsl:when test="$affected=$affected_equipment">
				<tr bgcolor="#ffffff">
					<xsl:variable name="time_loc" select="./@time_loc"/>
					<xsl:variable name="date_time_loc" select="substring-before($time_loc, ' ')"/>
					<xsl:variable name="time_time_loc" select="substring-after($time_loc, ' ')"/>
					<xsl:variable name="status" select="./@status"/>
					<xsl:variable name="remark" select="./@remark"/>
					<xsl:variable name="remark_before" select="substring-before($remark, ' ')"/>
					<xsl:variable name="remark_after" select="substring-after($remark, ' ')"/>
					<xsl:choose><xsl:when test="$date_time_loc=$eventdate">
							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;<xsl:value-of select="$time_time_loc"/></nobr></FONT></td>
					</xsl:when><xsl:otherwise>
							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;<xsl:value-of select="$time_loc"/></nobr></FONT></td>
					</xsl:otherwise></xsl:choose>
      				<xsl:choose><xsl:when test="$status='Open'">
      					<xsl:choose><xsl:when test="$remark_before='ตก'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ตก</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:when test="$remark_before='ไม่ตก'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ไม่ตก</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
						</xsl:when><xsl:when test="$remark_before='ตกสับติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สวิตช์ตกสับติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:otherwise>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;Open</nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      					</xsl:otherwise></xsl:choose>
      				</xsl:when><xsl:when test="$status='Close'">
      					<xsl:choose><xsl:when test="$remark_before='สับติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สับติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
      					</xsl:when><xsl:when test="$remark_before='สับไม่ติด'">
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;สับไม่ติด</nobr></FONT></td>
      							<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark_after"/></nobr></FONT></td>
						</xsl:when><xsl:otherwise>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;Close</nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      					</xsl:otherwise></xsl:choose>
 					</xsl:when><xsl:otherwise>
 						<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$status"/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="./@type"/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="."/></nobr></FONT></td>
      					<td><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;<xsl:value-of select="$remark"/></nobr></FONT></td>
      				</xsl:otherwise></xsl:choose>
    			</tr>
			</xsl:when></xsl:choose>
  		</xsl:for-each>
	</table>
</xsl:template>

<xsl:template match="si_list">
	<FONT face="tohoma" style="font-size: 9pt"><nobr><U>Supply Interruptions</U></nobr></FONT>
	<table border="0">
		<tr bgcolor="#ffffff">
			<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;Begin</nobr></FONT></td>
			<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>End</nobr></FONT></td>
			<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>Interrupted active power</nobr></FONT></td>
			<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>EU-transformer</nobr></FONT></td>
			<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>Station</nobr></FONT></td>
		</tr>
		<xsl:for-each select="si">
			<tr bgcolor="#ffffff">
				<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr>&#160;&#160;&#160;&#160;<xsl:value-of select="e_d_v_vubtime"/></nobr></FONT></td>
				<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="e_d_v_vuetime"/></nobr></FONT></td>
				<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="e_d_d_vupower"/></nobr></FONT></td>
				<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="e_d_b_vubtrafo"/></nobr></FONT></td>
				<td align="center"><FONT face="tohoma" style="font-size: 9pt"><nobr><xsl:value-of select="e_d_l_vustation"/></nobr></FONT></td>
			</tr>
		</xsl:for-each>
	</table>
	<BR></BR>
</xsl:template>

<xsl:template name="test_txt_filetypes">
    <xsl:param name="list"/>
    <xsl:param name="ist_typ"/>
    <xsl:param name="cur_name"/>
    <xsl:param name="cur_desc"/>
    <xsl:variable name="newlist" select="concat(normalize-space($list), ' ')"/>
    <xsl:variable name="first" select="substring-before($newlist, ' ')"/>
    <xsl:variable name="remaining" select="substring-after($newlist, ' ')"/>
    <xsl:variable name="vreftyp" select="$first"/>

    <xsl:choose>
        <xsl:when test="$vreftyp=$ist_typ">
            <!-- txt Filetype gefunden -->
            <xsl:call-template name="mtext"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:choose>
                <xsl:when test="$remaining">
                    <!-- weiteres Listenelement vorhanden, also weitersuchen -->
                    <xsl:call-template name="test_txt_filetypes">
                        <xsl:with-param name="list" select="$remaining"/>
                        <xsl:with-param name="ist_typ" select="$ist_typ"/>
                        <xsl:with-param name="cur_name" select="$cur_name"/>
                        <xsl:with-param name="cur_desc" select="$cur_desc"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    <!-- Dateityp nicht in der Liste   img_list -->
                    <xsl:call-template name="test_img_filetypes">
                        <xsl:with-param name="list"><xsl:value-of select="$img_list"/></xsl:with-param>
                        <xsl:with-param name="ist_typ" select="$ist_typ"/>
                        <xsl:with-param name="cur_name" select="$cur_name"/>
                        <xsl:with-param name="cur_desc" select="$cur_desc"/>
                    </xsl:call-template>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="test_img_filetypes">
    <xsl:param name="list"/>
    <xsl:param name="ist_typ"/>
    <xsl:param name="cur_name"/>
    <xsl:param name="cur_desc"/>
    <xsl:variable name="newlist" select="concat(normalize-space($list), ' ')"/>
    <xsl:variable name="first" select="substring-before($newlist, ' ')"/>
    <xsl:variable name="remaining" select="substring-after($newlist, ' ')"/>
    <xsl:variable name="vreftyp" select="$first"/>

    <xsl:choose>
        <xsl:when test="$vreftyp=$ist_typ">
            <!-- IMG Filetype gefunden -->
            <xsl:call-template name="mimage"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:choose>
                <xsl:when test="$remaining">
                    <!-- weiteres Listenelement vorhanden, also weitersuchen -->
                    <xsl:call-template name="test_img_filetypes">
                        <xsl:with-param name="list" select="$remaining"/>
                        <xsl:with-param name="ist_typ" select="$ist_typ"/>
                        <xsl:with-param name="cur_name" select="$cur_name"/>
                        <xsl:with-param name="cur_desc" select="$cur_desc"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    <!-- Dateityp nicht in der Liste   img_list -->
                    <tr bgcolor="#ffffff">
                    		<td><FONT face="tohoma" style="font-size: 9pt"><a><xsl:attribute name="href">./.<xsl:value-of select="$cur_name"/></xsl:attribute><xsl:value-of select="$cur_desc"/></a></FONT></td>
                    </tr>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="mimage">
        <tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt">Image "<xsl:value-of select="./@desc"/>"</FONT></td></tr>
        <tr bgcolor="#ffffff"><td>&#160;&#160;
        	<xsl:element name="IMG">
            	<xsl:attribute name="SRC">./.<xsl:value-of select="."/></xsl:attribute>
        	</xsl:element>
        </td></tr>
</xsl:template>

<xsl:template name="mtext">
        <tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt">Text "<xsl:value-of select="./@desc"/>"</FONT></td></tr>
        <tr bgcolor="#ffffff"><td>
        	<table border="0">
            	<xsl:for-each select="./item">
	            		<tr bgcolor="#ffffff"><td><FONT face="tohoma" style="font-size: 9pt">&#160;&#160;&#160;<xsl:value-of select="."/></FONT></td></tr>
            	</xsl:for-each>
        	</table>
        </td></tr>
</xsl:template>

</xsl:stylesheet>