<?xml version="1.0"?>
<?altova_samplexml file:///C:/eclipse/workspace/5700/Elba5_Doku/analyse/evaluierungen/mbs60/Transformer%20EBZ/in_out/in.xml?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mbs="http://www.stuzza.at/MBS/V7.0.04/EBZ" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="mbs xalan">
	<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="yes" xalan:line-separator="\n"/>
	<!-- *********************************************************************************** -->
	<!-- ***     Versionsstand: 20.01.2025                                                     *** -->
	<!-- ************************************************************************************ -->
	<!-- Root -->
	<xsl:template match="mbs:Document">
		<html version="-//www.buergerkarte.at//DOCUMENT SLXHTML 1.2//DE">
			<head>
				<title>EBICS Authorisation Cancellation Summary</title>
				<style type="text/css">
					body {font-family:monospace; font-size: 12px;color:#000000; text-align:left;font-weight:normal;}
					h1 {font-family:sans-serif; font-size:15; font-weight:bold;}
					h2 {font-family:sans-serif; font-size:13px; font-weight:bold;}
					.red {font-family:monospace;color:red;}
					.green {color:green;}
					.black {color:black;}
					.bold {font-family:monospace; font-size:12px; font-weight:bold;text-align:left;}
					.italic {font-family:monospace; font-size:12px; font-style:italic;text-align:left;}
					.normal {font-family:monospace; font-size:12px; text-align:left;}
				</style>
			</head>
			<body>
				<div>
					<xsl:apply-templates select="mbs:MBS_Electronic_Synopsis"/>
				</div>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="mbs:MBS_Electronic_Synopsis">
		<!-- Headerdaten -->
		<div>
			<!-- Trailer -->
			<xsl:apply-templates select="mbs:EBZCore/mbs:EbzTrlr"/>
			<xsl:apply-templates select="mbs:EBZCore/mbs:EbzHdr"/>
			<br/>
		</div>
		<!-- Unterschriftsdaten -->
		<div>
			<h2>Signature data</h2>
			<hr/>
			<xsl:if test="mbs:DspsrTrsprt or mbs:FrstSgntry or mbs:ScndSgntry">
				<xsl:if test="mbs:DspsrTrsprt">
					<xsl:apply-templates select="mbs:DspsrTrsprt"/>
				</xsl:if>
				<xsl:if test="mbs:FrstSgntry">
					<xsl:apply-templates select="mbs:FrstSgntry"/>
				</xsl:if>
				<xsl:if test="mbs:ScndSgntry">
					<xsl:apply-templates select="mbs:ScndSgntry"/>
				</xsl:if>
				<xsl:if test="mbs:NotRelSgntrs">
					<hr/>
					<xsl:apply-templates select="mbs:NotRelSgntrs"/>
					<hr/>
				</xsl:if>
				<br/>
			</xsl:if>
			<br/>
		</div>
		<!-- Sections -->
		<div>
			<h2>Record data</h2>
			<hr/>
			<xsl:apply-templates select="mbs:EBZCore/mbs:EbzSctns"/>
		</div>
		<!-- Reportlines -->
		<div>
			<h2>Error report</h2>
			<hr/>
			<span class="bold">
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="'Section/No.'"/>
					<xsl:with-param name="width" select="20"/>
				</xsl:call-template>
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="'Error'"/>
					<xsl:with-param name="width" select="10"/>
				</xsl:call-template>
				<xsl:text>Text</xsl:text>
			</span>
			<br/>
			<xsl:apply-templates select="mbs:StsRpt[last()]/mbs:StsInf"/>
		</div>
	</xsl:template>
	<!-- Headerdaten schreiben -->
	<xsl:template match="mbs:EBZCore/mbs:EbzTrlr">
		<h1>EBICS Authorisation Cancellation Summary</h1>
		<br/>
		<h2>Technical data</h2>
		<hr/>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Number of Transactions:'"/>
			<xsl:with-param name="width" select="25"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:TtlNbOfTxs"/>
		</xsl:call-template>		
		<br/>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Control sum:'"/>
			<xsl:with-param name="width" select="25"/>
		</xsl:call-template>
		<xsl:value-of select="mbs:CtrlSum"/>
		<br/>
	</xsl:template>
	<xsl:template match="mbs:EbzHdr">
		<br/>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Bank server:'"/>
			<xsl:with-param name="width" select="25"/>
		</xsl:call-template>
		<xsl:value-of select="mbs:InstnNm"/>
		<br/>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Created on:'"/>
			<xsl:with-param name="width" select="25"/>
		</xsl:call-template>
		<xsl:value-of select="concat(substring(mbs:CreDtTm,1,10),' ',substring(mbs:CreDtTm,12,5))"/>
		<xsl:call-template name="dup">
			<xsl:with-param name="input" select=" '&#160;' "/>
			<xsl:with-param name="count" select="3"/>
		</xsl:call-template>
		<xsl:value-of select="'by:'"/>
		<xsl:call-template name="dup">
			<xsl:with-param name="input" select=" '&#160;' "/>
			<xsl:with-param name="count" select="3"/>
		</xsl:call-template>
		<xsl:value-of select="mbs:CstmrNm/mbs:Prsn"/>
		<br/>
	</xsl:template>
	<!-- Transportsicherung -->
	<xsl:template match="mbs:DspsrTrsprt">
		<xsl:if test="string-length(mbs:CreDtTm) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Transport signature:'"/>
				<xsl:with-param name="width" select="25"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="concat(substring(mbs:CreDtTm,1,10),' ',substring(mbs:CreDtTm,12,5))"/>
				<xsl:with-param name="width" select="18"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Authorisee:'"/>
				<xsl:with-param name="width" select="10"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Dspsr/mbs:DspsrNm"/>
				<xsl:with-param name="width" select="36"/>
			</xsl:call-template>
			<xsl:value-of select="mbs:Dspsr/mbs:DspsrNbr"/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!-- erste Unterschrift -->
	<xsl:template match="mbs:FrstSgntry">
		<xsl:if test="string-length(mbs:CreDtTm) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'First signature:'"/>
				<xsl:with-param name="width" select="25"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="concat(substring(mbs:CreDtTm,1,10),' ',substring(mbs:CreDtTm,12,5))"/>
				<xsl:with-param name="width" select="18"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Authorisee:'"/>
				<xsl:with-param name="width" select="10"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Dspsr/mbs:DspsrNm"/>
				<xsl:with-param name="width" select="36"/>
			</xsl:call-template>
			<xsl:value-of select="mbs:Dspsr/mbs:DspsrNbr"/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!-- zweite Unterschrift -->
	<xsl:template match="mbs:ScndSgntry">
		<xsl:if test="string-length(mbs:CreDtTm) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Second signature:'"/>
				<xsl:with-param name="width" select="25"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="concat(substring(mbs:CreDtTm,1,10),' ',substring(mbs:CreDtTm,12,5))"/>
				<xsl:with-param name="width" select="18"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Authorisee:'"/>
				<xsl:with-param name="width" select="10"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Dspsr/mbs:DspsrNm"/>
				<xsl:with-param name="width" select="36"/>
			</xsl:call-template>
			<xsl:value-of select="mbs:Dspsr/mbs:DspsrNbr"/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!-- nicht relevante Unterschriften -->
	<xsl:template match="mbs:NotRelSgntrs">
		<xsl:if test="string-length(mbs:CreDtTm) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'not relevant:'"/>
				<xsl:with-param name="width" select="25"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="concat(substring(mbs:CreDtTm,1,10),' ',substring(mbs:CreDtTm,12,5))"/>
				<xsl:with-param name="width" select="18"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Authorisee:'"/>
				<xsl:with-param name="width" select="10"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Dspsr/mbs:DspsrNm"/>
				<xsl:with-param name="width" select="36"/>
			</xsl:call-template>
			<xsl:value-of select="mbs:Dspsr/mbs:DspsrNbr"/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!-- Sections schreiben -->
	<xsl:template match="mbs:EbzSctns">
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:SctnHdr/mbs:SctnNb"/>
			<xsl:with-param name="width" select="4"/>
		</xsl:call-template>
		<span class="bold">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:SctnHdr/mbs:OrdrTpGnrl"/>
				<xsl:with-param name="width" select="17"/>
			</xsl:call-template>
		</span>		
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Reference : '"/>
			<xsl:with-param name="width" select="14"/>
			<xsl:with-param name="align" select="'right'"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:SctnHdr/mbs:Ref"/>
			<xsl:with-param name="width" select="39"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="'Control sum: '"/>
			<xsl:with-param name="width" select="15"/>
			<xsl:with-param name="align" select="'right'"/>
		</xsl:call-template>
		<xsl:value-of select="mbs:ChckSum"/>
		<br/>		
		<hr/>
		<span class="italic">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'No.'"/>
				<xsl:with-param name="width" select="7"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'St'"/>
				<xsl:with-param name="width" select="3"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Typ'"/>
				<xsl:with-param name="width" select="4"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Account'"/>
				<xsl:with-param name="width" select="35"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'WHG'"/>
				<xsl:with-param name="width" select="4"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Record reference'"/>
				<xsl:with-param name="width" select="17"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Record sum'"/>
				<xsl:with-param name="width" select="19"/>
				<xsl:with-param name="align" select="'right'"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'CCY'"/>
				<xsl:with-param name="width" select="5"/>
				<xsl:with-param name="align" select="'center'"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Date'"/>
				<xsl:with-param name="width" select="10"/>
			</xsl:call-template>
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="'Nb. of Tx.'"/>
				<xsl:with-param name="width" select="21"/>
				<xsl:with-param name="align" select="'right'"/>
			</xsl:call-template>
		</span>
		<br/>
		<xsl:apply-templates select="mbs:SctnDtls">
			<xsl:with-param name="sectionNr" select="mbs:SctnHdr/mbs:SctnNb"/>
		</xsl:apply-templates>
		<br/>
	</xsl:template>
	<!-- Sectiondetails schreiben -->
	<xsl:template match="mbs:SctnDtls">
		<xsl:param name="sectionNr"/>
		<xsl:call-template name="getStatusIndikator">
			<xsl:with-param name="sectionNr" select="$sectionNr"/>
			<xsl:with-param name="sequenceNr" select="mbs:SeqNb"/>
			<xsl:with-param name="getTr" select="'true'"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:SeqNb"/>
			<xsl:with-param name="width" select="7"/>
		</xsl:call-template>
		<xsl:call-template name="getStatusIndikator">
			<xsl:with-param name="sectionNr" select="$sectionNr"/>
			<xsl:with-param name="sequenceNr" select="mbs:SeqNb"/>
			<xsl:with-param name="getTr" select="'false'"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:OrdrTpSpcfc"/>
			<xsl:with-param name="width" select="4"/>
		</xsl:call-template>
		<xsl:if test="string-length(mbs:Acct/mbs:IBAN) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Acct/mbs:IBAN"/>
				<xsl:with-param name="width" select="35"/>
			</xsl:call-template>
		</xsl:if>
		<xsl:if test="string-length(mbs:Acct/mbs:SWIFTAcct/mbs:AcctId/mbs:IBAN) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Acct/mbs:SWIFTAcct/mbs:AcctId/mbs:IBAN"/>
				<xsl:with-param name="width" select="35"/>
			</xsl:call-template>
		</xsl:if>
		<xsl:if test="string-length(mbs:Acct/mbs:SWIFTAcct/mbs:AcctId/mbs:OthrAcctId) &gt; 0">
			<xsl:call-template name="justify">
				<xsl:with-param name="value" select="mbs:Acct/mbs:SWIFTAcct/mbs:AcctId/mbs:OthrAcctId"/>
				<xsl:with-param name="width" select="35"/>
			</xsl:call-template>
		</xsl:if>
		<xsl:choose>
			<xsl:when test="string-length(mbs:Acct/@CCy) = 0">
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="'EUR'"/>
					<xsl:with-param name="width" select="4"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="mbs:Acct/@CCy"/>
					<xsl:with-param name="width" select="4"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:BtchRef"/>
			<xsl:with-param name="width" select="17"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:BtchSum"/>
			<xsl:with-param name="width" select="19"/>
			<xsl:with-param name="align" select="'right'"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:BtchSum/@Ccy"/>
			<xsl:with-param name="width" select="5"/>
			<xsl:with-param name="align" select="'center'"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:ExctnDt"/>
			<xsl:with-param name="width" select="10"/>
		</xsl:call-template>
		<xsl:call-template name="justify">
			<xsl:with-param name="value" select="mbs:NbOfTxs"/>
			<xsl:with-param name="width" select="18"/>
			<xsl:with-param name="align" select="'right'"/>
		</xsl:call-template>
		<br/>
		<xsl:text disable-output-escaping="yes"><![CDATA[</span>]]></xsl:text>
	</xsl:template>
	<!-- Zusätzliche Statusinformationen -->
	<xsl:template match="mbs:StsRpt/mbs:StsInf">
		<!-- statusindikator prüfen -->
		<xsl:if test="mbs:StsInd = 'FF' or mbs:StsInd = '1E' ">
			<span class="normal">
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="mbs:CrossRef/mbs:SctnNb"/>
					<xsl:with-param name="width" select="3"/>
				</xsl:call-template>
				<xsl:choose>
					<xsl:when test="string-length(mbs:CrossRef/mbs:TillSctnNb) = 0 and string-length(mbs:CrossRef/mbs:SeqNb) = 0">
						<!-- keine tillsection oder tillsequence angegeben; padden -->
						<xsl:call-template name="dup">
							<xsl:with-param name="input" select=" '&#160;' "/>
							<xsl:with-param name="count" select="17"/>
						</xsl:call-template>
					</xsl:when>
					<xsl:when test="string-length(mbs:CrossRef/mbs:SeqNb) > 0">
						<!-- sequence ist angegeben -->
						<xsl:value-of select=" '/' "/>
						<xsl:call-template name="justify">
							<xsl:with-param name="value" select="mbs:CrossRef/mbs:SeqNb"/>
							<xsl:with-param name="width" select="6"/>
						</xsl:call-template>
						<xsl:if test="string-length(mbs:CrossRef/mbs:TillSeqNb) > 0">
							<xsl:value-of select=" '-' "/>
							<xsl:call-template name="justify">
								<xsl:with-param name="value" select="mbs:CrossRef/mbs:TillSeqNb"/>
								<xsl:with-param name="width" select="9"/>
							</xsl:call-template>
						</xsl:if>
						<xsl:if test="string-length(mbs:CrossRef/mbs:TillSeqNb) = 0">
							<!-- padden -->
							<xsl:call-template name="dup">
								<xsl:with-param name="input" select=" '&#160;' "/>
								<xsl:with-param name="count" select="10"/>
							</xsl:call-template>
						</xsl:if>
					</xsl:when>
					<xsl:otherwise>
						<!-- TillSection ausgeben-->
						<xsl:value-of select=" '-' "/>
						<xsl:call-template name="justify">
							<xsl:with-param name="value" select="mbs:CrossRef/mbs:TillSctnNb"/>
							<xsl:with-param name="width" select="16"/>
						</xsl:call-template>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:call-template name="justify">
					<xsl:with-param name="align" select="'left'"/>
					<xsl:with-param name="value" select="mbs:RptLine/mbs:RptDtls/mbs:StsNum"/>
					<xsl:with-param name="width" select="10"/>
				</xsl:call-template>
				<xsl:value-of select="mbs:RptLine/mbs:RptDtls/mbs:StsTxt"/>
				<br/>
				<xsl:if test="string-length(mbs:RptLine/mbs:RptDtls/mbs:FreeTxt) &gt; 0">
					<xsl:for-each select="mbs:RptLine/mbs:RptDtls/mbs:FreeTxt">
						<xsl:call-template name="dup">
							<xsl:with-param name="input" select=" '&#160;' "/>
							<xsl:with-param name="count" select="30"/>
						</xsl:call-template>
						<xsl:value-of select="."/>
						<br/>
					</xsl:for-each>
				</xsl:if>
			</span>
		</xsl:if>
	</xsl:template>
	<!-- Ermittelt den Statusindikator zum aktuellen Bestand sowie die aktuelle 
		Zeilenfarbe für den Bestand -->
	<xsl:template name="getStatusIndikator">
		<xsl:param name="sectionNr"/>
		<xsl:param name="sequenceNr"/>
		<xsl:param name="getTr"/>
		<xsl:variable name="test" select="/mbs:Document/mbs:MBS_Electronic_Synopsis/mbs:StsRpt[last()]/mbs:StsInf[((string-length(mbs:CrossRef/mbs:TillSctnNb) = 0 and string-length(mbs:CrossRef/mbs:SeqNb) = 0 and mbs:CrossRef/mbs:SctnNb=$sectionNr) or (string-length(mbs:CrossRef/mbs:TillSctnNb) != 0 and mbs:CrossRef/mbs:SctnNb&lt;=$sectionNr and mbs:CrossRef/mbs:TillSctnNb&gt;=$sectionNr) or (mbs:CrossRef/mbs:SctnNb=$sectionNr and string-length(mbs:CrossRef/mbs:TillSeqNb) = 0 and mbs:CrossRef/mbs:SeqNb=$sequenceNr) or (mbs:CrossRef/mbs:SctnNb=$sectionNr and string-length(mbs:CrossRef/mbs:TillSeqNb) != 0 and mbs:CrossRef/mbs:SeqNb&lt;=$sequenceNr and mbs:CrossRef/mbs:TillSeqNb&gt;=$sequenceNr))]/mbs:StsInd"/>
		<xsl:choose>
			<xsl:when test="$getTr = 'true' ">
				<xsl:choose>
					<xsl:when test="$test = 'OK' ">
						<xsl:text disable-output-escaping="yes"><![CDATA[<span class="green">]]></xsl:text>
					</xsl:when>
					<xsl:when test="$test = 'FF' ">
						<xsl:text disable-output-escaping="yes"><![CDATA[<span class="red">]]></xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text disable-output-escaping="yes"><![CDATA[<span class="black">]]></xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="justify">
					<xsl:with-param name="value" select="$test"/>
					<xsl:with-param name="width" select="3"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- Duplizierung von Eingangsdaten -->
	<xsl:template name="dup">
		<xsl:param name="input"/>
		<xsl:param name="count" select="2"/>
		<xsl:choose>
			<xsl:when test="not($count) or not($input)"/>
			<xsl:when test="$count = 1">
				<xsl:value-of select="$input" disable-output-escaping="yes"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="$count mod 2">
					<xsl:value-of select="$input" disable-output-escaping="yes"/>
				</xsl:if>
				<xsl:call-template name="dup">
					<xsl:with-param name="input" select="concat($input, $input)"/>
					<xsl:with-param name="count" select="floor($count div 2)"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- Hilfsfunktion zur Justierung von Text -->
	<xsl:template name="justify">
		<xsl:param name="value"/>
		<xsl:param name="width" select="10"/>
		<xsl:param name="align" select=" 'left' "/>
		<xsl:variable name="output" select="substring($value,1,$width)"/>
		<xsl:choose>
			<xsl:when test="$align = 'left'">
				<xsl:value-of select="$output"/>
				<xsl:call-template name="dup">
					<xsl:with-param name="input" select=" '&#160;' "/>
					<xsl:with-param name="count" select="$width - string-length($output)"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:when test="$align = 'right'">
				<xsl:call-template name="dup">
					<xsl:with-param name="input" select=" '&#160;' "/>
					<xsl:with-param name="count" select="$width - string-length($output)"/>
				</xsl:call-template>
				<xsl:value-of select="$output"/>
			</xsl:when>
			<xsl:when test="$align = 'center'">
				<xsl:call-template name="dup">
					<xsl:with-param name="input" select=" '&#160;' "/>
					<xsl:with-param name="count" select="floor(($width - string-length($output)) div 2)"/>
				</xsl:call-template>
				<xsl:value-of select="$output"/>
				<xsl:call-template name="dup">
					<xsl:with-param name="input" select=" '&#160;' "/>
					<xsl:with-param name="count" select="ceiling(($width - string-length($output)) div 2)"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>INVALID ALIGN</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
