﻿<?xml version="1.0" encoding="UTF-8"?>
<!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	-->
<!--  The Svefaktura Reference Stylesheet  - - - - - - - - - - - - - - - - - - - - - - - - - -    			-->
<!--  -2007-10-02 Version 1.0  Issued by SFTI (Single Face To industry) 						-->
<!--  -2008-12-10 Version 1.03 A couple of elements added; enhancements to date/time and article number presentations	-->
<!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    			-->
<!--	This stylesheet is for free use, but at user's own risk  - - - - - - - - - - - - - - - -    			-->
<!--	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    			-->
<!--	Editorial notes      												-->
<!--	1)	Namespace: xmlns:fn="http://www.w3.org/2005/xpath-functions", meaning the xpath 2.0       		-->
<!--		functions, are not currently supported in the xslt processor included in the .net       		-->
<!-- 		framework. Only the "substring" function is used in this version.      					-->
<!--	2)	The stylseheet presupposes that Svefaktura instances that have been verified.      			-->
<!--	3)	Note that white space inside elements may give rise to errors.						-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	-->

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cbc="urn:oasis:names:tc:ubl:CommonBasicComponents:1:0" xmlns:ccts="urn:oasis:names:tc:ubl:CoreComponentParameters:1:0" xmlns:sdt="urn:oasis:names:tc:ubl:SpecializedDatatypes:1:0" xmlns:udt="urn:oasis:names:tc:ubl:UnspecializedDatatypes:1:0" xmlns:cur="urn:oasis:names:tc:ubl:codelist:CurrencyCode:1:0" xmlns:cac="urn:sfti:CommonAggregateComponents:1:0" xmlns:n1="urn:sfti:documents:BasicInvoice:1:0">
	<xsl:output version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="no" media-type="text/html"/>

	<!-- Named template for formating of date-time display: -->
	<xsl:template name="showDate">
		<!-- Date format: YYYY-mm-DDThh:MM:ss -->
		<xsl:param name="date"/>
		<xsl:choose>
			<!-- Time component considered insignificant if all zeros: -->
			<xsl:when test="substring($date,11,9)='T00:00:00'">
				<xsl:value-of select="substring($date,1,10)" /> 
			</xsl:when>
			<!-- Second component considered insignificant if all zeros: -->
			<xsl:when test="substring($date,18,2)='00'">
				<xsl:value-of select="substring($date,1,10)" /> 
				&#160;
				<xsl:value-of select="substring($date,12,5)" /> 
			</xsl:when>
			<!-- Or else display the complete date and time components: -->
			<xsl:otherwise>
				<xsl:value-of select="substring($date,1,10)" /> 
				&#160;
				<xsl:value-of select="substring($date,12,8)" /> 
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<!-- Named template to handle line-breaks in Note elements: -->
	<xsl:template name="breakNote">
		<xsl:param name="text" select="cbc:Note"/>
		<xsl:choose>
			<xsl:when test="contains($text, '&#xa;')">
				<xsl:value-of select="substring-before($text, '&#xa;')"/>
				<br/>
				<xsl:call-template name="breakNote">
					<xsl:with-param name="text" select="substring-after($text,'&#xa;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Named template to handle the exceptional situation where due dates in the various PaymentMeans differ: -->
	<xsl:template name="resolvePgBgBank">
		<xsl:for-each select="cac:PaymentMeans">
			<xsl:choose>
				<xsl:when test="cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='BGABSESS'">
					Bg:
				</xsl:when>
				<xsl:when test="cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='PGSISESS'">
					Pg:
				</xsl:when>
				<xsl:otherwise>
					Bank:
				</xsl:otherwise>
			</xsl:choose>
			<xsl:choose>
				<xsl:when test="string(cbc:DuePaymentDate)!=''">
					<xsl:value-of select="cbc:DuePaymentDate"/>
					<br/>
				</xsl:when>
				<xsl:otherwise>
					<font color="red">Uppg saknas</font>  <br/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="/">
		<html>
			<head>
				<title>Svefaktura</title>
				<style type="text/css">

table.detailedTable {
	border-width: 1px 1px 1px 1px;
	padding: 1px 1px 1px 1px;
	border-style: solid solid solid solid;
	border-color: black black black black;
	border-collapse: collapse;
	background-color: white;
}
td.detailedTable {
	border-width: 1px 1px 1px 1px;

}

table {
	border-collapse: collapse;
	background-color: white;
}
table th {
	border-width: 0px 0px 0px 0px;
	padding: 1px 1px 1px 1px;
	border-style: solid solid solid solid;
	border-color: black black black black;
	background-color: white;
	-moz-border-radius: 0px 0px 0px 0px;
}
table td {
	border-width: 0px 0px 0px 0px;
	padding: 1px 1px 1px 1px;
	border-style: solid solid solid solid;
	border-color: black black black black;
	background-color: white;
	-moz-border-radius: 0px 0px 0px 0px;
}
				
				BODY, TABLE, TR, TD, P {font-family: arial, verdana, sans-serif; font-size: 11px; font-weight: normal;}
				</style>
			</head>
			<body>
				<xsl:for-each select="n1:Invoice">
					<table border="1" width="95%" cellspacing="5" cellpadding="5">
						<tr>
							<td>
								<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
									<TR>
										<TD>
											<STRONG>
												<FONT size="4">
													<xsl:if test="n1:InvoiceTypeCode=381">
											Kreditnota
										</xsl:if>
													<xsl:if test="n1:InvoiceTypeCode=380">
											Faktura
										</xsl:if>
												</FONT>
											</STRONG>
										</TD>
										<TD/>
										<TD/>
										<TD align="right">
											<STRONG>
												<FONT size="2">Fakturanummer&#160;
												<xsl:value-of select="n1:ID"/>
												</FONT>
											</STRONG>
										</TD>
										<td/>
									</TR>
									<TR>
										<TD valign="top">
											<P>
												<font size="2">
													<STRONG>Säljare</STRONG>
												</font>
												<BR/>
												<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<xsl:for-each select="cac:SellerParty/cac:Party/cac:PartyName/cbc:Name">
														<TR>
															<TD>
																<xsl:value-of select="."/>
															</TD>
														</TR>
													</xsl:for-each>
													<xsl:for-each select="cac:SellerParty/cac:Party/cac:PartyIdentification">
														<TR>
															<TD>
																(PartsID:<xsl:value-of select="cac:ID"/>)
															</TD>
														</TR>
													</xsl:for-each>
													<xsl:if test="cac:SellerParty/cac:Party/cac:Address/cac:ID!=''">
														<TR>
															<TD>
																(AdressID:<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cac:ID"/>)
															</TD>
														</TR>
													</xsl:if>
													<xsl:if test="cac:SellerParty/cac:Party/cac:Address/cbc:Department!=''">
														<tr>
															<td>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cbc:Department"/>
															</td>
														</tr>
													</xsl:if>
													<TR>
														<TD>
															<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cbc:StreetName"/>
															<xsl:if test="cac:SellerParty/cac:Party/cac:Address/cbc:Postbox!=''">
																<xsl:if test="cac:SellerParty/cac:Party/cac:Address/cbc:StreetName!=''">;&#160;</xsl:if>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cbc:Postbox"/>
															</xsl:if>
														</TD>
													</TR>
													<xsl:for-each select="cac:SellerParty/cac:Party/cac:Address/cac:AddressLine/cbc:Line">
														<tr>
															<td>
																<xsl:value-of select="."/>
															</td>
														</tr>
													</xsl:for-each>
													<TR>
														<TD>
															<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cbc:PostalZone"/>&#160;<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cbc:CityName"/>&#160;<xsl:value-of select="cac:SellerParty/cac:Party/cac:Address/cac:Country/cac:IdentificationCode"/>
														</TD>
													</TR>
												</TABLE>
												<STRONG>Kontaktuppgifter</STRONG>
												<BR/>
												<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<xsl:if test="cac:SellerParty/cac:Party/cac:Contact/cbc:Name!=''">
														<TR>
															<td>Kontakt:</td>
															<TD>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Contact/cbc:Name"/>
															</TD>
														</TR>
													</xsl:if>
													<xsl:if test="cac:SellerParty/cac:Party/cac:Contact/cbc:Telephone!=''">
														<TR>
															<td>Telefon:</td>
															<TD>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Contact/cbc:Telephone"/>
															</TD>
														</TR>
													</xsl:if>
													<xsl:if test="cac:SellerParty/cac:Party/cac:Contact/cbc:Telefax!=''">
														<tr>
															<td>Fax:</td>
															<TD>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Contact/cbc:Telefax"/>
															</TD>
														</tr>
													</xsl:if>
													<xsl:if test="cac:SellerParty/cac:Party/cac:Contact/cbc:ElectronicMail!=''">
														<tr>
															<td>E-post:</td>
															<TD>
																<xsl:value-of select="cac:SellerParty/cac:Party/cac:Contact/cbc:ElectronicMail"/>
															</TD>
														</tr>
													</xsl:if>
													<tr>
														<td>
															<!-- LEAVE THIS! Without this empty row the table may may be empty, which under some  
																circumstances may give rendering errors in certin browsers. -->
														</td>
													</tr>
												</TABLE>
											</P>
										</TD>
										<TD valign="top">
											<P>
												<font size="2">
													<STRONG>Köpare</STRONG>
												</font>
												<BR/>
												<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<xsl:for-each select="cac:BuyerParty/cac:Party/cac:PartyName/cbc:Name">
														<TR>
															<TD>
																<xsl:value-of select="."/>
															</TD>
														</TR>
													</xsl:for-each>
													<xsl:for-each select="cac:BuyerParty/cac:Party/cac:PartyIdentification">
														<TR>
															<TD>
																(PartsID:<xsl:value-of select="cac:ID"/>)
															</TD>
														</TR>
													</xsl:for-each>
													<xsl:if test="cac:BuyerParty/cac:Party/cac:Address/cac:ID!=''">
														<TR>
															<TD>
																(AdressID:<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cac:ID"/>)
															</TD>
														</TR>
													</xsl:if>
													<xsl:if test="cac:BuyerParty/cac:Party/cac:Address/cbc:Department!=''">
														<tr>
															<td>
																<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cbc:Department"/>
															</td>
														</tr>
													</xsl:if>
													<TR>
														<TD>
															<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cbc:StreetName"/>
															<xsl:if test="cac:BuyerParty/cac:Party/cac:Address/cbc:Postbox!=''">
																<xsl:if test="cac:BuyerParty/cac:Party/cac:Address/cbc:StreetName!=''">;&#160;</xsl:if>
																<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cbc:Postbox"/>
															</xsl:if>
														</TD>
													</TR>
													<xsl:for-each select="cac:BuyerParty/cac:Party/cac:Address/cac:AddressLine/cbc:Line">
														<tr>
															<td>
																<xsl:value-of select="."/>
															</td>
														</tr>
													</xsl:for-each>
													<TR>
														<TD>
															<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cbc:PostalZone"/>&#160;<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cbc:CityName"/>&#160;<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Address/cac:Country/cac:IdentificationCode"/>
														</TD>
													</TR>
												</TABLE>
												<STRONG>Leveransadress</STRONG>
												<BR/>
												<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<xsl:if test="cac:Delivery/cac:DeliveryAddress/cac:ID!=''">
														<TR>
															<td>
																(AdressID:<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cac:ID"/>)
															</td>
														</TR>
													</xsl:if>
													<xsl:if test="cac:Delivery/cac:DeliveryAddress/cbc:Department!=''">
														<tr>
															<td>
																<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cbc:Department"/>
															</td>
														</tr>
													</xsl:if>
													<TR>
														<TD>
															<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cbc:StreetName"/>
															<xsl:if test="cac:Delivery/cac:DeliveryAddress/cbc:Postbox!=''">
																<xsl:if test="cac:Delivery/cac:DeliveryAddress/cbc:StreetName!=''">;&#160;</xsl:if>
																<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cbc:Postbox"/>
															</xsl:if>
														</TD>
													</TR>
													<xsl:for-each select="cac:Delivery/cac:DeliveryAddress/cac:AddressLine/cbc:Line">
														<tr>
															<td>
																<xsl:value-of select="."/>
															</td>
														</tr>
													</xsl:for-each>
													<TR>
														<TD>
															<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cbc:PostalZone"/>&#160;<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cbc:CityName"/>&#160;<xsl:value-of select="cac:Delivery/cac:DeliveryAddress/cac:Country/cac:IdentificationCode"/>
														</TD>
													</TR>
												</TABLE>
											</P>
										</TD>
										<TD/>
										<td valign="top" align="left" width="50%">
											<font size="2">
												<STRONG>Fakturameddelande</STRONG>
												<br/>
											</font>
											<xsl:call-template name="breakNote"/>
										</td>
									</TR>
								</TABLE>
								<HR width="100%" SIZE="1"/>
								<table id="5a" cellSpacing="1" cellPadding="1" width="100%" border="0">
									<tr>
										<td valign="top">
											<p>
												<table id="5b" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<tr>
														<TD valign="top">
															<STRONG>Beställarreferens</STRONG>
														</TD>
														<TD valign="top">
															<xsl:value-of select="n1:RequisitionistDocumentReference[1]/cac:ID"/>
														</TD>
													</tr>
													<tr>
														<TD valign="top">
															<STRONG>Beställarreferens2</STRONG>
														</TD>
														<TD>
															<xsl:value-of select="n1:RequisitionistDocumentReference[2]/cac:ID"/>
														</TD>
													</tr>
													<xsl:if test="cac:BuyerParty/cac:Party/cac:Contact!=''">
														<tr>
															<TD valign="top">
																<STRONG>Er kontakt</STRONG>
															</TD>
															<TD  valign="top">
																<xsl:if test="cac:BuyerParty/cac:Party/cac:Contact/cbc:Name!=''">
																	<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Contact/cbc:Name"/>
																	<br/>
																</xsl:if>
																<xsl:if test="cac:BuyerParty/cac:Party/cac:Contact/cbc:Telephone!=''">
																	Tel: 
																	<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Contact/cbc:Telephone"/>
																	<br/>
																</xsl:if>
																<xsl:if test="cac:BuyerParty/cac:Party/cac:Contact/cbc:Telefax!=''">
																	Fax: 
																	<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Contact/cbc:Telefax"/>
																	<br/>
																</xsl:if>
																<xsl:if test="cac:BuyerParty/cac:Party/cac:Contact/cbc:ElectronicMail!=''">
																	E-post:
																	<xsl:value-of select="cac:BuyerParty/cac:Party/cac:Contact/cbc:ElectronicMail"/>
																</xsl:if>
															</TD>
														</tr>
													</xsl:if>
													<TR>
														<TD valign="top">
															<STRONG>Ert VAT-nummer</STRONG>
														</TD>
														<TD>
															<xsl:value-of select="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cac:CompanyID"/>
															<xsl:if test="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:RegistrationName!=''">
																<br/>
																<xsl:value-of select="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:RegistrationName"/>
															</xsl:if>
														</TD>
													</TR>
													<xsl:if test="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:CompanyID!=''">
														<TR>
															<TD>
																<strong>Ert organisationsnr</strong>
															</TD>
															<TD>
																<xsl:value-of select="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:CompanyID"/>
																<xsl:if test="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cbc:RegistrationName!=''">
																	<br/>
																	<xsl:value-of select="cac:BuyerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cbc:RegistrationName"/>
																</xsl:if>
															</TD>
														</TR>
													</xsl:if>
												</table>
											</p>
										</td>
										<td valign="top">
											<div>
												&#160;
											</div>
										</td>
										<td valign="top">
											<p>
												<table id="5d" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<tr>
														<TD valign="top">
															<STRONG>Vår referens</STRONG>
														</TD>
														<TD valign="top">
															<xsl:if test="cac:SellerParty/cac:AccountsContact/cbc:Name!=''">
																<xsl:value-of select="cac:SellerParty/cac:AccountsContact/cbc:Name"/>
																<br/>
															</xsl:if>
															<xsl:if test="cac:SellerParty/cac:AccountsContact/cbc:Telephone!=''">
																Tel: <xsl:value-of select="cac:SellerParty/cac:AccountsContact/cbc:Telephone"/>
																<br/>
															</xsl:if>
															<xsl:if test="cac:SellerParty/cac:AccountsContact/cbc:Telefax!=''">
																Fax: <xsl:value-of select="cac:SellerParty/cac:AccountsContact/cbc:Telefax"/>
																<br/>
															</xsl:if>
															<xsl:if test="cac:SellerParty/cac:AccountsContact/cbc:ElectronicMail!=''">
																E-post: <xsl:value-of select="cac:SellerParty/cac:AccountsContact/cbc:ElectronicMail"/>
															</xsl:if>
														</TD>
													</tr>
													<xsl:if test="n1:AdditionalDocumentReference!=''">
														<tr>
															<TD valign="top">
																<STRONG>Dokumentreferens</STRONG>
															</TD>
															<TD valign="top">
																<xsl:for-each select="n1:AdditionalDocumentReference">
																	<xsl:if test="cac:ID/@identificationSchemeID='ACD'"> 
																		Faktureringsobjekt:
																	</xsl:if>
																	<xsl:if test="cac:ID/@identificationSchemeID='CT'"> 
																		Kontrakt:
																	</xsl:if>
																	<xsl:if test="cac:ID/@identificationSchemeID='DQ'"> 
																		Följesedel:
																	</xsl:if>
																	<xsl:if test="cac:ID/@identificationSchemeID='ATS'"> 
																		URN:
																	</xsl:if>
																	<xsl:value-of select="cac:ID"/>
																	<br/>
																</xsl:for-each>
															</TD>
														</tr>
													</xsl:if>
													<xsl:if test="n1:InitialInvoiceDocumentReference!=''">
														<tr>
															<TD valign="top">
																<STRONG>Tidigare faktura nr</STRONG>
															</TD>
															<TD>
																<xsl:for-each select="n1:InitialInvoiceDocumentReference">
																	<xsl:value-of select="cac:ID"/>
																	<br/>
																</xsl:for-each>
															</TD>
														</tr>
													</xsl:if>
													<xsl:if test="cac:DeliveryTerms/cbc:SpecialTerms!=''">
														<tr>
															<TD valign="top">
																<STRONG>Leveransvillkor</STRONG>
															</TD>
															<TD>
																<xsl:value-of select="cac:DeliveryTerms/cbc:SpecialTerms"/>
															</TD>
														</tr>
													</xsl:if>
													<xsl:if test="cac:Delivery/cbc:ActualDeliveryDateTime!=''">
														<tr>
															<TD valign="top">
																<strong>Leveransdatum</strong>
															</TD>
															<TD valign="top">
																<xsl:call-template name="showDate">
																	<xsl:with-param name="date" select="cac:Delivery/cbc:ActualDeliveryDateTime"/>
																</xsl:call-template>
															</TD>
														</tr>
													</xsl:if>
													<xsl:if test="n1:TaxPointDate!=''">
														<tr>
															<td valign="top">
																<strong>Datum för skatt</strong>
															</td>
															<TD>
																<xsl:value-of select="n1:TaxPointDate"/>
															</TD>
														</tr>
													</xsl:if>
												</table>
											</p>
										</td>
										<td valign="top">
											<p>
												<table id="5c" cellSpacing="1" cellPadding="1" width="100%" border="0">
													<tr>
														<TD valign="top">
															<strong>Fakturadatum</strong>
														</TD>
														<TD>
															<xsl:value-of select="cbc:IssueDate"/>
														</TD>
													</tr>
													<xsl:if test="n1:InvoicingPeriod/cbc:StartDateTime!='' or n1:InvoicingPeriod/cbc:EndDateTime!=''">
														<tr>
															<TD valign="top">
																<strong>Fakturaperiod</strong>
															</TD>
															<TD valign="top">
																<xsl:choose>
																	<xsl:when test="n1:InvoicingPeriod/cbc:StartDateTime!='' and
																			n1:InvoicingPeriod/cbc:EndDateTime!='' ">
																		<xsl:choose>
																			<xsl:when test="substring(n1:InvoicingPeriod/cbc:StartDateTime,11,9)='T00:00:00' and
																					substring(n1:InvoicingPeriod/cbc:EndDateTime,11,9)='T00:00:00' ">
																				<!-- Time components with all zeroes (in both start and end dates) considered insignificant: -->
																				Från: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:StartDateTime,1,10)" />  
																				<br/>
																				Till: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:EndDateTime,1,10)" />
																			</xsl:when>
																			<xsl:when test="substring(n1:InvoicingPeriod/cbc:StartDateTime,18,2)='00' and
																					substring(n1:InvoicingPeriod/cbc:EndDateTime,18,2)='00' ">
																				<!-- Second components with all zeroes (in both start and end dates) considered insignificant: -->
																				Från: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:StartDateTime,1,10)" />  
																				&#160;
																				<xsl:value-of select="substring(n1:InvoicingPeriod/cbc:StartDateTime,12,5)" /> 
																				<br/>
																				Till: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:EndDateTime,1,10)" />
																				&#160;
																				<xsl:value-of select="substring(n1:InvoicingPeriod/cbc:EndDateTime,12,5)" />
																			</xsl:when>
																			<xsl:otherwise>
																				Från: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:StartDateTime,1,10)" />  
																				&#160;
																				<xsl:value-of select="substring(n1:InvoicingPeriod/cbc:StartDateTime,12,8)" /> 
																				<br/>
																				Till: <xsl:value-of select="substring(n1:InvoicingPeriod/cbc:EndDateTime,1,10)" />
																				&#160;
																				<xsl:value-of select="substring(n1:InvoicingPeriod/cbc:EndDateTime,12,8)" />
																			</xsl:otherwise>
																		</xsl:choose>
																	</xsl:when>
																	<xsl:when test="n1:InvoicingPeriod/cbc:StartDateTime!=''">
																		Från: <xsl:call-template name="showDate">
																			<xsl:with-param name="date" select="n1:InvoicingPeriod/cbc:StartDateTime"/>
																		</xsl:call-template>
																		<br/>
																		Till: <font color="red">Datum saknas</font>
																	</xsl:when>
																	<xsl:when test="n1:InvoicingPeriod/cbc:EndDateTime!=''">
																		Från: <font color="red">Datum saknas</font>
																		<br/>
																		Till: <xsl:call-template name="showDate">
																			<xsl:with-param name="date" select="n1:InvoicingPeriod/cbc:EndDateTime"/>
																		</xsl:call-template>																	</xsl:when>
																	<xsl:otherwise>
																		Händer bara inte!!!
																	</xsl:otherwise>
																</xsl:choose>
															</TD>
														</tr>
													</xsl:if>
													<tr>
														<td>
															<strong>Fakturans valuta</strong>
														</td>
														<TD>
															<xsl:value-of select="n1:InvoiceCurrencyCode"/>
														</TD>
													</tr>
													<xsl:if test="cac:PaymentTerms/cbc:Note!=''">
														<tr>
															<TD valign="top">
																<STRONG>Betalningsvillkor</STRONG>
															</TD>
															<TD>
																<xsl:value-of select="cac:PaymentTerms/cbc:Note"/>
															</TD>
														</tr>
													</xsl:if>
													<tr>
														<TD valign="top">
															<STRONG>Förfallodatum</STRONG>
														</TD>
														<TD>
															<xsl:choose>
																<xsl:when test="string(cac:PaymentMeans[3])!=''">
																	<!-- If 3 PaymentMeans elements are present -->
																	<xsl:choose>
																		<xsl:when test="(string(cac:PaymentMeans[3]/cbc:DuePaymentDate)=string(cac:PaymentMeans[2]/cbc:DuePaymentDate) and string(cac:PaymentMeans[2]/cbc:DuePaymentDate)=string(cac:PaymentMeans[1]/cbc:DuePaymentDate))">
																			<xsl:value-of select="cac:PaymentMeans[1]/cbc:DuePaymentDate" /> 
																		</xsl:when>
																		<xsl:otherwise>
																			<xsl:call-template name="resolvePgBgBank"/>
																		</xsl:otherwise>
																	</xsl:choose>
																</xsl:when>
																<xsl:when test="string(cac:PaymentMeans[3])='' and string(cac:PaymentMeans[2])!=''">
																	<!-- If 2 PaymentMeans elements are present -->
																	<xsl:choose>
																		<xsl:when test="(string(cac:PaymentMeans[2]/cbc:DuePaymentDate)=string(cac:PaymentMeans[1]/cbc:DuePaymentDate))">
																			<xsl:value-of select="cac:PaymentMeans[1]/cbc:DuePaymentDate" /> 
																		</xsl:when>
																		<xsl:otherwise>
																			<xsl:call-template name="resolvePgBgBank"/>
																		</xsl:otherwise>
																	</xsl:choose>
																</xsl:when>
																<xsl:when test="string(cac:PaymentMeans[3])='' and string(cac:PaymentMeans[2])=''">
																	<!-- If 0-1 PaymentMeans element present-->
																	<xsl:value-of select="cac:PaymentMeans[1]/cbc:DuePaymentDate" /> 
																</xsl:when>
															</xsl:choose>
														</TD>
													</tr>
													<xsl:if test="cac:PaymentTerms/cbc:PenaltySurchargePercent!=''">
														<tr>
															<TD>
																<STRONG>Dröjsmålsränta</STRONG>
															</TD>
															<TD>
																<xsl:value-of select="cac:PaymentTerms/cbc:PenaltySurchargePercent"/>
																		%
																</TD>
														</tr>
													</xsl:if>
												</table>
											</p>
										</td>
									</tr>
								</table>
								<HR width="100%" SIZE="1"/>
								<BR/>
								<strong>Fakturarader (<xsl:value-of select="n1:LineItemCountNumeric"/> styck)</strong>
								<table class="detailedTable" id="Table6" width="100%">
									<TR>
										<TD class="detailedTable">
											<STRONG>Radnr</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Benämning</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Anteckning</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Levererad<br/>kvantitet</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>À-pris</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Summa</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Summan inkluderar</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Skatt</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Orderref<BR/>/radnr</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Följesedel<BR/>/radnr</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Leveransdatum</STRONG>
										</TD>
										<TD class="detailedTable">
											<STRONG>Artikelnummer</STRONG>
										</TD>
									</TR>
									<xsl:for-each select="cac:InvoiceLine">
										<TR>
											<TD class="detailedTable" align="right">
												<xsl:value-of select="cac:ID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:Item/cbc:Description"/>
											</TD>
											<TD class="detailedTable">
												<xsl:call-template name="breakNote"/>&#160;
											</TD>
											<TD class="detailedTable" align="right">
												<xsl:value-of select="cbc:InvoicedQuantity"/>&#160;<xsl:value-of select="cbc:InvoicedQuantity/@quantityUnitCode"/>
											</TD>
											<TD class="detailedTable" align="right">
												<xsl:value-of select="cac:Item/cac:BasePrice/cbc:PriceAmount"/>&#160;<xsl:value-of select="cac:Item/cac:BasePrice/cbc:PriceAmount/@amountCurrencyID"/>
												<xsl:if test="cac:Item/cac:BasePrice/cbc:BaseQuantity!=''">
													<br/>
													per&#160;<xsl:value-of select="cac:Item/cac:BasePrice/cbc:BaseQuantity"/>&#160;<xsl:value-of select="cac:Item/cac:BasePrice/cbc:BaseQuantity/@quantityUnitCode"/>
												</xsl:if>
											</TD>
											<TD class="detailedTable" align="right">
												<xsl:value-of select="cbc:LineExtensionAmount"/>&#160;<xsl:value-of select="cbc:LineExtensionAmount/@amountCurrencyID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:if test="cac:AllowanceCharge/cbc:ChargeIndicator!=''">
													<xsl:choose>
														<xsl:when test="cac:AllowanceCharge/cbc:ChargeIndicator='true' or cac:AllowanceCharge/cbc:ChargeIndicator='1'">
															Avgift:
														</xsl:when>
														<xsl:otherwise>
															Rabatt:
														</xsl:otherwise>
													</xsl:choose>
												</xsl:if>
												&#160;
												<xsl:value-of select="cac:AllowanceCharge/cbc:Amount"/>&#160;<xsl:value-of select="cac:AllowanceCharge/cbc:Amount/@amountCurrencyID"/>
												<xsl:if test="cac:AllowanceCharge/cac:AllowanceChargeBaseAmount!=''">
													<br/> (underlag:&#160;
													<xsl:value-of select="cac:AllowanceCharge/cac:AllowanceChargeBaseAmount"/>&#160;<xsl:value-of select="cac:AllowanceCharge/cac:AllowanceChargeBaseAmount/@amountCurrencyID"/>)
												</xsl:if>
											</TD>
											<TD class="detailedTable">
												<xsl:if test="cac:Item/cac:TaxCategory[cac:TaxScheme/cac:ID='VAT']/cbc:Percent!=''">
													<xsl:value-of select="cac:Item/cac:TaxCategory[cac:TaxScheme/cac:ID='VAT']/cbc:Percent"/>%
												</xsl:if>
												&#160;
												<xsl:if test="cac:Item/cac:TaxCategory[cac:TaxScheme/cac:ID='VAT']/cbc:ExemptionReason!=''">
													<br/>
													<xsl:value-of select="cac:Item/cac:TaxCategory[cac:TaxScheme/cac:ID='VAT']/cbc:ExemptionReason"/>
												</xsl:if>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:OrderLineReference/cac:OrderReference/cac:BuyersID"/>
												<xsl:if test="cac:OrderLineReference/cac:BuyersLineID!=''">
													<xsl:if test="cac:OrderLineReference/cac:OrderReference/cac:BuyersID!=''">
														<br/>
													</xsl:if>
													/<xsl:value-of select="cac:OrderLineReference/cac:BuyersLineID"/>
												</xsl:if>
												&#160;
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:DespatchLineReference/cac:DocumentReference/cac:ID"/>
												<xsl:if test="cac:DespatchLineReference/cac:LineID!=''">
													<xsl:if test="cac:DespatchLineReference/cac:DocumentReference/cac:ID!=''">
														<br/>
													</xsl:if>
													/<xsl:value-of select="cac:DespatchLineReference/cac:LineID"/>
												</xsl:if>
												&#160;
											</TD>
											<TD class="detailedTable">
												<xsl:if test="cac:Delivery/cbc:ActualDeliveryDateTime!=''">
													<xsl:call-template name="showDate">
														<xsl:with-param name="date" select="cac:Delivery/cbc:ActualDeliveryDateTime"/>
													</xsl:call-template>
													&#160;
												</xsl:if>
											</TD>
											<TD class="detailedTable">
												<xsl:if test="cac:Item/cac:SellersItemIdentification/cac:ID!=''">
													<xsl:if test="cac:Item/cac:BuyersItemIdentification/cac:ID!='' or
															cac:Item/cac:StandardItemIdentification/cac:ID!=''">
														Säljarens:&#160;
													</xsl:if>
													<xsl:value-of select="cac:Item/cac:SellersItemIdentification/cac:ID"/>
												</xsl:if>
												<xsl:if test="cac:Item/cac:BuyersItemIdentification/cac:ID!=''">
													<xsl:if test="cac:Item/cac:SellersItemIdentification/cac:ID!=''">
														<br/>
													</xsl:if>
													<xsl:if test="cac:Item/cac:SellersItemIdentification/cac:ID!='' or
															cac:Item/cac:StandardItemIdentification/cac:ID!=''">
														Köparens:&#160;
													</xsl:if>
													<xsl:value-of select="cac:Item/cac:BuyersItemIdentification/cac:ID"/>
												</xsl:if>
												<xsl:if test="cac:Item/cac:StandardItemIdentification/cac:ID!=''">
													<xsl:choose>
														<xsl:when test="cac:Item/cac:BuyersItemIdentification/cac:ID!=''">
															<br/>
														</xsl:when>
														<xsl:otherwise>
															<xsl:if test="cac:Item/cac:SellersItemIdentification/cac:ID!=''">
																<br/>
															</xsl:if>
														</xsl:otherwise>
													</xsl:choose>
													<xsl:if test="cac:Item/cac:SellersItemIdentification/cac:ID!='' or
															cac:Item/cac:BuyersItemIdentification/cac:ID!=''">
														Standard:&#160;
													</xsl:if>
													<xsl:value-of select="cac:Item/cac:StandardItemIdentification/cac:ID"/>
												</xsl:if>
												
											</TD>
										</TR>
									</xsl:for-each>
								</table>
								<xsl:if test="n1:AllowanceCharge/cbc:ChargeIndicator!=''">
									<BR/>
									<strong>Rabatter och avgifter</strong>
									<TABLE class="detailedTable" id="TableRabatterOAvgifter" width="100%">
										<tr>
											<td class="detailedTable">
												<strong>Typ</strong>
											</td>
											<td class="detailedTable">
												<strong>Orsak</strong>
											</td>
											<td class="detailedTable">
												<strong>Belopp</strong>
											</td>
											<td class="detailedTable">
												<strong>Underlag för beräkning</strong>
											</td>
											<td class="detailedTable">
												<strong>Skatteinformation</strong>
											</td>
										</tr>
										<xsl:for-each select="n1:AllowanceCharge">
											<tr>
												<td class="detailedTable">
													<xsl:choose>
														<xsl:when test="cbc:ChargeIndicator='true' or cbc:ChargeIndicator='1'">
													Avgift
													</xsl:when>
														<xsl:otherwise>
													Rabatt
													</xsl:otherwise>
													</xsl:choose>
												</td>
												<td class="detailedTable">
													<xsl:value-of select="cac:ReasonCode/@name"/>&#160;
											</td>
												<td class="detailedTable">
													<xsl:value-of select="cbc:Amount"/>&#160;<xsl:value-of select="cbc:Amount/@amountCurrencyID"/>
												</td>
												<td class="detailedTable">
													<xsl:if test="cbc:MultiplierFactorNumeric!=''">
														<xsl:value-of select="cbc:MultiplierFactorNumeric"/>%
													<xsl:if test="cac:AllowanceChargeBaseAmount!=''">&#160;av&#160;</xsl:if>
													</xsl:if>
													<xsl:value-of select="cac:AllowanceChargeBaseAmount"/>&#160;<xsl:value-of select="cac:AllowanceChargeBaseAmount/@amountCurrencyID"/>
												</td>
												<td class="detailedTable">
													<xsl:value-of select="cac:TaxCategory[cac:TaxScheme/cac:ID='VAT']/cbc:Percent"/>%&#160; 								
												<xsl:value-of select="cac:TaxCategory/cbc:ExemptionReason"/>&#160;
											</td>
											</tr>
										</xsl:for-each>
									</TABLE>
								</xsl:if>
								<BR/>
								<strong>Fakturans mervärdesskatter</strong>
								<TABLE class="detailedTable" id="TableSkatteSubTotaler" width="100%">
									<tr>
										<td class="detailedTable">
											<strong>Skattesats</strong>
										</td>
										<td class="detailedTable">
											<strong>Skattebelopp</strong>
										</td>
										<td class="detailedTable">
											<strong>Omräknat skattebelopp</strong>
										</td>
										<td class="detailedTable">
											<strong>Skattepliktigt belopp</strong>
										</td>
										<td class="detailedTable">
											<strong>Ev undantagsorsak</strong>
										</td>
										<td class="detailedTable">
											<strong>Ev ursprunglig fakturas skatt</strong>
										</td>
									</tr>
									<xsl:for-each select="cac:TaxTotal/cac:TaxSubTotal">
										<tr>
											<td class="detailedTable">
												<xsl:value-of select="cac:TaxCategory/cbc:Percent"/>%&#160;
											</td>
											<td class="detailedTable">
												<xsl:value-of select="cbc:TaxAmount"/>&#160;<xsl:value-of select="cbc:TaxAmount/@amountCurrencyID"/>
											</td>
											<td class="detailedTable">
												<xsl:value-of select="cac:TaxCurrencyTaxAmount"/>&#160;<xsl:value-of select="cac:TaxCurrencyTaxAmount/@amountCurrencyID"/>
											</td>
											<td class="detailedTable">
												<xsl:value-of select="cbc:TaxableAmount"/>&#160;<xsl:value-of select="cbc:TaxableAmount/@amountCurrencyID"/>
											</td>
											<td class="detailedTable">
												<xsl:value-of select="cac:TaxCategory/cbc:ExemptionReason"/>&#160;
											</td>
											<td class="detailedTable">
												<xsl:value-of select="cac:InitialInvoiceTaxAmount"/>&#160;<xsl:value-of select="cac:InitialInvoiceTaxAmount/@amountCurrencyID"/>&#160;
											</td>
										</tr>
									</xsl:for-each>
								</TABLE>
								<xsl:if test="cac:ExchangeRate/cac:TargetCurrencyCode!=''">
									Omräkning av skattebelopp har skett från&#160; <xsl:value-of select="cac:ExchangeRate/cbc:SourceCurrencyBaseRate"/> &#160;<xsl:value-of select="cac:ExchangeRate/cac:SourceCurrencyCode"/>
									till&#160; <xsl:value-of select="cac:ExchangeRate/cbc:TargetUnitBaseRate"/> &#160;<xsl:value-of select="cac:ExchangeRate/cac:TargetCurrencyCode"/>&#160; enligt kurs&#160;<xsl:value-of select="cac:ExchangeRate/cbc:CalculationRate"/>,&#160;kursdatum&#160;<xsl:value-of select="cac:ExchangeRate/cbc:Date"/>
								</xsl:if>
								<BR/>
								<BR/>
								<font size="3">
									<strong>Totalbelopp</strong>
									<TABLE class="detailedTable" id="Table7" width="100%">
										<TR>
											<TD class="detailedTable">
												<STRONG>Summa radbelopp</STRONG>
											</TD>
											<TD class="detailedTable">
												<STRONG>Fakturerat belopp exkl moms</STRONG>
											</TD>
											<TD class="detailedTable">
												<STRONG>Mervärdesskatt</STRONG>
											</TD>
											<TD class="detailedTable">
												<STRONG>Beloppsutjämning</STRONG>
											</TD>
											<TD class="detailedTable">
												<STRONG>Fakturan totalt (inkl mervärdesskatt)</STRONG>
											</TD>
										</TR>
										<TR>
											<TD class="detailedTable">
												<xsl:value-of select="cac:LegalTotal/cbc:LineExtensionTotalAmount"/>&#160;<xsl:value-of select="cac:LegalTotal/cbc:LineExtensionTotalAmount/@amountCurrencyID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:LegalTotal/cbc:TaxExclusiveTotalAmount"/>&#160;<xsl:value-of select="cac:LegalTotal/cbc:TaxExclusiveTotalAmount/@amountCurrencyID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:TaxTotal/cbc:TotalTaxAmount"/>&#160;<xsl:value-of select="cac:TaxTotal/cbc:TotalTaxAmount/@amountCurrencyID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:LegalTotal/cac:RoundOffAmount"/>&#160;<xsl:value-of select="cac:LegalTotal/cac:RoundOffAmount/@amountCurrencyID"/>
											</TD>
											<TD class="detailedTable">
												<xsl:value-of select="cac:LegalTotal/cbc:TaxInclusiveTotalAmount"/>&#160;<xsl:value-of select="cac:LegalTotal/cbc:TaxInclusiveTotalAmount/@amountCurrencyID"/>
											</TD>
										</TR>
									</TABLE>
								</font>
								<BR/>
								<TABLE id="Table8" cellSpacing="1" cellPadding="1" width="100%" border="0">
									<tr>
										<td/>
										<td>
											<STRONG>Denna faktura kan betalas till:</STRONG>
										</td>
									</tr>
									<TR>
										<TD>
										</TD>
										<TD>
											<STRONG>Bankgiro</STRONG>
										</TD>
										<TD>
											<STRONG>Ange vid betalning via BG</STRONG>
										</TD>
										<TD>
											<STRONG>Företagets säte</STRONG>
										</TD>
										<TD>
											<STRONG>F-skatt:</STRONG>
										</TD>
									</TR>
									<TR>
										<TD/>
										<TD>
											<xsl:value-of select="cac:PaymentMeans/cac:PayeeFinancialAccount[cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='BGABSESS']/cac:ID"/>
											<xsl:if test="cac:PaymentMeans[cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='BGABSESS']/cac:PayeePartyName/cbc:Name!=''">
												<br/>
												<xsl:value-of select="cac:PaymentMeans[cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='BGABSESS']/cac:PayeePartyName/cbc:Name"/>
											</xsl:if>
										</TD>
										<TD valign="top">
											<xsl:value-of select="cac:PaymentMeans/cac:PayeeFinancialAccount[cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='BGABSESS']/cac:PaymentInstructionID"/>
										</TD>
										<TD valign="top">
											<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:RegistrationAddress/cbc:CityName"/>
											&#160;<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:RegistrationAddress/cac:Country/cac:IdentificationCode"/>
										</TD>
										<TD valign="top">
											<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cbc:ExemptionReason"/>
										</TD>
									</TR>
									<TR>
										<TD>
											
										</TD>
										<TD>
											<STRONG>Plusgiro</STRONG>
										</TD>
										<TD>
											<STRONG>Ange vid betalning via PG</STRONG>
										</TD>
										<TD>
											<STRONG>Organisationsnummer</STRONG>
										</TD>
										<TD>
											<STRONG>Momsregistreringsnummer</STRONG>
										</TD>
									</TR>
									<TR>
										<TD/>
										<TD valign="top">
											<xsl:value-of select="cac:PaymentMeans/cac:PayeeFinancialAccount[cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='PGSISESS']/cac:ID"/>
											<xsl:if test="cac:PaymentMeans[cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='PGSISESS']/cac:PayeePartyName/cbc:Name!=''">
												<br/>
												<xsl:value-of select="cac:PaymentMeans[cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='PGSISESS']/cac:PayeePartyName/cbc:Name"/>
											</xsl:if>
										</TD>
										<TD valign="top">
											<xsl:value-of select="cac:PaymentMeans/cac:PayeeFinancialAccount[cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID='PGSISESS']/cac:PaymentInstructionID"/>
										</TD>
										<TD valign="top">
											<xsl:choose>
												<xsl:when test="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:CompanyID!=''">
													<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cac:CompanyID"/>
												</xsl:when>
												<xsl:otherwise>
													<font color="red">Organisationsnummer saknas</font>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cbc:RegistrationName!=''">
												<br/>
												<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='SWT']/cbc:RegistrationName"/>
											</xsl:if>
										</TD>
										<TD valign="top">
											<xsl:choose>
												<xsl:when test="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cac:CompanyID!=''">
													<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cac:CompanyID"/>
												</xsl:when>
												<xsl:otherwise>
													<font color="red">Momsregistreringsnummer saknas</font>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:RegistrationName!=''">
												<br/>
												<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:RegistrationName"/>
											</xsl:if>
											<xsl:if test="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:ExemptionReason!=''">
												<br/>
												<xsl:value-of select="cac:SellerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cac:ID='VAT']/cbc:ExemptionReason"/>
											</xsl:if>
										</TD>
									</TR>
									<xsl:for-each select="cac:PaymentMeans">
										<xsl:if test="cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID!='PGSISESS'">
											<xsl:if test="cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID!='BGABSESS'">
												<TR>
													<TD/>
													<TD>
														<STRONG>Bank (BIC):
                              <xsl:value-of select="cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cac:FinancialInstitution/cac:ID"/>
														</STRONG>
													</TD>
													<TD>
														<STRONG>Ange vid betalning till bank:</STRONG>
													</TD>
												</TR>
												<TR>
													<TD/>
													<TD>
														<xsl:value-of select="cac:PayeeFinancialAccount/cac:ID"/>
														<xsl:for-each select="cac:PayeePartyName/cbc:Name">
															<br/>
															<xsl:value-of select="."/>
														</xsl:for-each>
													</TD>
													<TD valign="top">
														<xsl:value-of select="cac:PayeeFinancialAccount/cac:PaymentInstructionID"/>
													</TD>
												</TR>
											</xsl:if>
										</xsl:if>
									</xsl:for-each>
								</TABLE>
							</td>
						</tr>
					</table>
				</xsl:for-each>
				<p>
					<font color="Gray">
				Denna fakturabild är baserad på ett elektroniskt fakturadokument (Svefaktura) som presenteras genom ett XSL-stylesheet. Version av stylesheet är 1.03</font>
				</p>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

