<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xsl:output method="xml"/>
	<xsl:template match="fattura">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
		<!--		<xsl:choose>
					<xsl:when test="multiple-copies='false'">-->
						<fo:simple-page-master master-name="main" page-height="297mm"
							page-width="210mm" margin-top="6mm" margin-bottom="10mm"
							margin-left="5mm" margin-right="5mm">
							<fo:region-body margin-top="120mm" margin-bottom="55mm"/>
							<fo:region-before extent="120mm"/>
							<fo:region-after extent="55mm"/>
						</fo:simple-page-master>
				<!--	</xsl:when>
					<xsl:otherwise>-->
						<fo:simple-page-master master-name="main-destinatario" page-height="297mm"
							page-width="210mm" margin-top="6mm" margin-bottom="10mm"
							margin-left="5mm" margin-right="5mm">
							<fo:region-body margin-top="120mm" margin-bottom="55mm"/>
							<fo:region-before extent="120mm"/>
							<fo:region-after extent="55mm"/>
						</fo:simple-page-master>
						<fo:simple-page-master master-name="main-mittente" page-height="297mm"
							page-width="210mm" margin-top="6mm" margin-bottom="10mm"
							margin-left="5mm" margin-right="5mm">
							<fo:region-body margin-top="120mm" margin-bottom="55mm"/>
							<fo:region-before extent="120mm"/>
							<fo:region-after extent="55mm"/>
						</fo:simple-page-master>
						<fo:simple-page-master master-name="main-archivio" page-height="297mm"
							page-width="210mm" margin-top="6mm" margin-bottom="10mm"
							margin-left="5mm" margin-right="5mm">
							<fo:region-body margin-top="120mm" margin-bottom="55mm"/>
							<fo:region-before extent="120mm"/>
							<fo:region-after extent="55mm"/>
						</fo:simple-page-master>
				<!--	</xsl:otherwise>
				</xsl:choose>-->
			</fo:layout-master-set>
			<xsl:choose>
				<xsl:when test="multiple-copies='false'">
					<fo:page-sequence master-reference="main" initial-page-number="1"
						force-page-count="no-force">
						<xsl:call-template name="main-document.header"/>
						<xsl:call-template name="main-document.footer">
							<xsl:with-param name="document-to"/>
						</xsl:call-template>
						<xsl:call-template name="main-document.body">
							<xsl:with-param name="document-to"/>
						</xsl:call-template>
					</fo:page-sequence>
				</xsl:when>
				<xsl:otherwise>
					<fo:page-sequence master-reference="main-destinatario" initial-page-number="1"
						force-page-count="no-force">
						<xsl:call-template name="main-document.header"/>
						<xsl:call-template name="main-document.footer">
							<xsl:with-param name="document-to">ORIGINALE</xsl:with-param>
							<xsl:with-param name="color">0</xsl:with-param>
						</xsl:call-template>
						<xsl:call-template name="main-document.body">
							<xsl:with-param name="document-to">ORIGINALE</xsl:with-param>
						</xsl:call-template>
					</fo:page-sequence>

					<fo:page-sequence master-reference="main-mittente" initial-page-number="1"
						force-page-count="no-force">
						<xsl:call-template name="main-document.header"/>
						<xsl:call-template name="main-document.footer">
							<xsl:with-param name="document-to">COPIA PER USO
								AMMINISTRATIVO</xsl:with-param>
							<xsl:with-param name="color">1</xsl:with-param>
						</xsl:call-template>
						<xsl:call-template name="main-document.body">
							<xsl:with-param name="document-to">COPIA PER USO
							AMMINISTRATIVO</xsl:with-param>
						</xsl:call-template>
					</fo:page-sequence>
					<fo:page-sequence master-reference="main-archivio" initial-page-number="1"
						force-page-count="no-force">
						<xsl:call-template name="main-document.header"/>
						<xsl:call-template name="main-document.footer">
							<xsl:with-param name="document-to">COPIA PER USO
								AMMINISTRATIVO</xsl:with-param>
							<xsl:with-param name="color">2</xsl:with-param>
						</xsl:call-template>
						<xsl:call-template name="main-document.body">
							<xsl:with-param name="document-to">COPIA PER USO
							AMMINISTRATIVO</xsl:with-param>
						</xsl:call-template>
					</fo:page-sequence>

				</xsl:otherwise>
			</xsl:choose>
		</fo:root>
	</xsl:template>
	<xsl:template match="carriageReturnValue">
		<fo:block font-family="sans-serif" font-size="12pt" space-before.minimum="2pt"
			space-before.maximum="6pt" space-before.optimum="4pt" space-after.minimum="2pt"
			space-after.maximum="6pt" space-after.optimum="4pt">
			<xsl:apply-templates/>
		</fo:block>

	</xsl:template>
	<!-- ******************************** -->
	<!--              TEMPLATES           -->
	<!-- ******************************** -->
	<!-- ******************************** -->
	<!--               HEADER             -->
	<!-- ******************************** -->
	<xsl:template name="main-document.header">
		<fo:static-content flow-name="xsl-region-before">

			
			<xsl:choose>
				<xsl:when test="heading/line-1=' '">
			<fo:table width="200mm" table-layout="fixed">
				<fo:table-column column-width="200mm"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell  >
							<fo:block font-family="Times" font-size="12pt" font-weight="bold"
								text-align="left" margin-left="15mm">
								<xsl:value-of disable-output-escaping="yes" select="heading/line-1"
								/>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell  >
							<fo:block>
								<fo:external-graphic scaling="non-uniform">
									<xsl:attribute name="content-height">
										<xsl:value-of select="concat(heading/logo-height,px)"/>
									</xsl:attribute>
									<xsl:attribute name="content-width">
										<xsl:value-of select="concat(heading/logo-width,px)"/>
									</xsl:attribute>
									
									
									<xsl:attribute name="src">
										<xsl:value-of select="heading/logo"/>
									</xsl:attribute>
								</fo:external-graphic>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
				</xsl:when>
			
			
			
			
			
			<xsl:otherwise>
			
			<fo:table width="200mm" table-layout="fixed">
				<fo:table-column column-width="42mm"/>
				<fo:table-column column-width="158mm"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell>
							<fo:block>
								<fo:external-graphic scaling="uniform">
									<xsl:attribute name="content-height">
										<xsl:value-of select="concat(heading/logo-height,px)"/>
									</xsl:attribute>
									<xsl:attribute name="content-width">
										<xsl:value-of select="concat(heading/logo-width,px)"/>
									</xsl:attribute>
									
									
									<xsl:attribute name="src">
										<xsl:value-of select="heading/logo"/>
									</xsl:attribute>
								</fo:external-graphic>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block height="5pt">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
							<fo:block font-family="Times" font-size="12pt" font-weight="bold"
								text-align="left" margin-left="15mm">
								<xsl:value-of disable-output-escaping="yes" select="heading/line-1"
								/>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
				</xsl:otherwise>
			</xsl:choose>
						
			<fo:block font-family="Times" font-size="10pt" text-align="left">
				<xsl:value-of disable-output-escaping="yes" select="heading/line-2"/>
			</fo:block>
			<fo:block font-family="Times" font-size="10pt" font-weight="bold" text-align="left">
				<xsl:value-of disable-output-escaping="yes" select="heading/line-3"/>
			</fo:block>
			<fo:block font-family="Times" font-size="10pt" text-align="left">
				<xsl:value-of disable-output-escaping="yes" select="heading/line-4"/>
			</fo:block>
			<fo:block font-family="Times" font-size="10pt" text-align="left">
				<xsl:value-of disable-output-escaping="yes" select="heading/line-5"/>
			</fo:block>
			<fo:block font-family="Times" font-size="10pt" text-align="left">
				<xsl:value-of disable-output-escaping="yes" select="heading/line-6"/>
			</fo:block>
			<xsl:if test="heading/spaceInHeading='true'">
				<fo:block font-family="Times" font-size="8pt" text-align="left">
					<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
				</fo:block>
			</xsl:if>
			<xsl:choose>
				<xsl:when test="facSimile='false'">
					<xsl:if test="heading/spaceInHeading='true'">
						<fo:block font-family="Times" font-size="8pt" text-align="left">
							<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
						</fo:block>
					</xsl:if>
				</xsl:when>
				<xsl:otherwise>
					<fo:table width="200mm" table-layout="fixed">
						<fo:table-column column-width="160mm"/>
						<fo:table-column column-width="40mm"/>
						<fo:table-body>
							<fo:table-row height="8mm">
								<fo:table-cell>
									 
										<fo:block font-family="Times" font-size="8pt" text-align="left">
											<xsl:text disable-output-escaping="yes">&#160;</xsl:text>
										</fo:block>
									 
								</fo:table-cell>
								<fo:table-cell>
									<fo:block font-family="Helvetica" font-size="16pt"
										text-align="center">
										<xsl:text disable-output-escaping="yes">FAC-SIMILE</xsl:text>
									</fo:block>
								</fo:table-cell>
							</fo:table-row>
						</fo:table-body>
					</fo:table>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="heading/spaceInHeading='true'">
				<fo:block font-family="Times" font-size="8pt" text-align="left">
					<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
				</fo:block>
			</xsl:if>
			<fo:table width="200mm" table-layout="fixed">
				<fo:table-column column-width="89.5mm"/>
				<fo:table-column column-width="10.6mm"/>
				<fo:table-column column-width="98.9mm"/>
				<fo:table-header>
					<fo:table-row>
						<xsl:choose>
							<xsl:when test="heading/stampaIndirizzo='true'">
								
									<fo:table-cell>
										<fo:block font-family="Courier" font-size="8pt" text-align="center">
											<xsl:text disable-output-escaping="yes">Ragione sociale</xsl:text>
										</fo:block>
									</fo:table-cell>		
							</xsl:when>
							<xsl:otherwise>
								<fo:table-cell>
									<fo:block font-family="Courier" font-size="8pt" text-align="center">
										<xsl:text disable-output-escaping="yes"></xsl:text>
									</fo:block>
								</fo:table-cell>	
							</xsl:otherwise>
						</xsl:choose>
						
						
						<fo:table-cell>
							<fo:block font-family="Times" font-size="8pt" text-align="left">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block font-family="Courier" font-size="8pt" text-align="center">
								<xsl:text disable-output-escaping="yes">Ragione sociale / Indirizzo spedizione</xsl:text>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-header>
				<fo:table-body>
					<fo:table-row height="38mm">
					
						
						
						<xsl:choose>
							<xsl:when test="heading/stampaIndirizzo='true'">
								
								<fo:table-cell background-image="AddressBox.gif">
									<fo:block font-family="Times" font-size="8pt" text-align="left">
										<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
									</fo:block>
									<fo:block font-family="Courier" font-size="10pt" text-align="left"
										margin-left="2mm" font-weight="bold">
										<xsl:text disable-output-escaping="yes">Spett.le</xsl:text>
									</fo:block>
									<fo:block font-family="Times" font-size="8pt" text-align="left">
										<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/ragSoc1"
										/>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/ragSoc2"
										/>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/ind1"/>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/ind2"/>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/citta"/>
									</fo:block>
									<fo:block font-family="Times" font-size="12pt" text-align="left"
										margin-left="10mm">
										<xsl:value-of disable-output-escaping="yes" select="cliente/iva"/>
									</fo:block>
								</fo:table-cell>	
							</xsl:when>
							<xsl:otherwise>
								<fo:table-cell>
									<fo:block font-family="Courier" font-size="8pt" text-align="center">
										<xsl:text disable-output-escaping="yes"></xsl:text>
									</fo:block>
								</fo:table-cell>	
							</xsl:otherwise>
						</xsl:choose>
						
						
						
						<fo:table-cell>
							<fo:block font-family="Times" font-size="8pt" text-align="left">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell background-image="AddressBoxDestinatario.gif"
							border-left-color="black">
							<fo:block font-family="Times" font-size="8pt" text-align="left">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
							<fo:block font-family="Courier" font-size="10pt" text-align="left"
								margin-left="2mm" font-weight="bold">
								<xsl:text disable-output-escaping="yes">Spett.le</xsl:text>
							</fo:block>
							<fo:block font-family="Times" font-size="8pt" text-align="left">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
							<fo:table width="98.9mm" table-layout="fixed">
								<fo:table-column column-width="85mm"/>
								<fo:table-column column-width="13.9mm"/>
								<fo:table-body>
									<fo:table-row >
										<fo:table-cell>
											<fo:block font-family="Times" font-size="12pt" text-align="left"
												margin-right="1mm" margin-left="10mm">
												<xsl:value-of disable-output-escaping="yes"
													select="fatturareA/ragSoc1"/>
											</fo:block>
											
										</fo:table-cell>
										<fo:table-cell>
											<fo:block font-family="Times" font-size="10pt" text-align="right" margin-right="1mm">
												<xsl:value-of disable-output-escaping="yes" select="fatturareA/codRiv"/>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
							
							
							
							
							<fo:block font-family="Times" font-size="12pt" text-align="left"
								margin-right="1mm" margin-left="10mm">
								<xsl:value-of disable-output-escaping="yes"
									select="fatturareA/ragSoc2"/>
							</fo:block>
						 
							
							
							<fo:table width="98.9mm" table-layout="fixed">
								<fo:table-column column-width="85mm"/>
								<fo:table-column column-width="13.9mm"/>
								<fo:table-body>
									<fo:table-row >
										<fo:table-cell>
											<fo:block font-family="Times" font-size="12pt" text-align="left"
												margin-right="1mm" margin-left="10mm">
												<xsl:value-of disable-output-escaping="yes"
													select="fatturareA/ind1"/>
											</fo:block>
											
										</fo:table-cell>
										<fo:table-cell>
											<fo:block font-family="Times" font-size="10pt" text-align="right" margin-right="1mm">
												<xsl:value-of disable-output-escaping="yes" select="fatturareA/giroPos"/>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
							
							
							
							<fo:block font-family="Times" font-size="12pt" text-align="left"
								margin-right="1mm" margin-left="10mm">
								<xsl:value-of disable-output-escaping="yes" select="fatturareA/ind2"
								/>
							</fo:block>
							<fo:block font-family="Times" font-size="12pt" text-align="left"
								margin-right="1mm" margin-left="10mm">
								<xsl:value-of disable-output-escaping="yes"
									select="fatturareA/citta"/>
							</fo:block>
							<fo:block font-family="Times" font-size="12pt" text-align="left"
								margin-right="1mm" margin-left="10mm">
								<xsl:value-of disable-output-escaping="yes" select="fatturareA/iva"
								/>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
			<fo:table width="95mm" table-layout="fixed">
				<fo:table-column column-width="95mm"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell>
							<fo:block font-family="Times" font-size="12pt" text-align="left">
								<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
			<fo:table width="200mm" table-layout="fixed" height="25mm">
				<fo:table-column column-width="200mm"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell>
							<fo:table table-layout="fixed" width="200mm">
								<fo:table-column column-width="25mm"/>
								<fo:table-column column-width="25mm"/>
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="110mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt"
											background-color="rgb(192,192, 192)">
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="center">Codice
												cliente</fo:block>
										</fo:table-cell>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt"
											background-color="rgb(192,192, 192)">
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="center"
												margin-left="1mm">Partita iva</fo:block>
										</fo:table-cell>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt"
											background-color="rgb(192,192, 192)">
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="center"
												margin-left="1mm">Codice fiscale</fo:block>
										</fo:table-cell>
										<fo:table-cell>
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="center"
												margin-left="1mm">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="25mm"/>
								<fo:table-column column-width="25mm"/>
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="110mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<xsl:value-of disable-output-escaping="yes"
												select="header/codCli"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<xsl:value-of disable-output-escaping="yes"
												select="header/piva"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<xsl:value-of disable-output-escaping="yes"
												select="header/codFis"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell>
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center"
												margin-left="1mm">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>

					<fo:table-row>
						<fo:table-cell>
							<fo:table background-color="rgb(192,192, 192)" table-layout="fixed"
								width="200mm">
								<fo:table-column column-width="70mm"/>
								<fo:table-column column-width="60mm"/>
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="30mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center">Tipo
												documento</fo:block>
										</fo:table-cell>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center">
												N<xsl:text disable-output-escaping="yes">&#38;#176;</xsl:text>
												documento </fo:block>
										</fo:table-cell>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center">Data
												documento</fo:block>
										</fo:table-cell>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center"
											>Pagina</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="70mm"/>
								<fo:table-column column-width="60mm"/>
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="30mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Times" font-size="9pt"
												font-weight="bold" text-align="center"
												padding-top="1mm">
												<xsl:value-of disable-output-escaping="yes"
												select="header/tipoDoc"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<xsl:value-of disable-output-escaping="yes"
												select="header/numFatt"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<xsl:value-of disable-output-escaping="yes"
												select="header/dataFatt"/>
											</fo:block>
										</fo:table-cell>
										<fo:table-cell display-align="center"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="center">
												<fo:page-number/> di <fo:page-number-citation
												ref-id="totalPageNumber"/>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="200mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell background-color="rgb(192,192, 192)"
											border-right-color="black" border-right-style="solid"
											border-right-width="0.5pt" border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="10pt"
												font-weight="bold" text-align="center"
											>Pagamento</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="200mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-right-color="black"
											border-right-style="solid" border-right-width="0.5pt"
											border-left-color="black" border-left-style="solid"
											border-left-width="0.5pt" border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Times" font-size="10pt"
												text-align="left" padding-top="1mm">
												<xsl:value-of disable-output-escaping="yes"
												select="header/pagamento"/>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</fo:static-content>
	</xsl:template>
	<!-- ******************************** -->
	<!--               BODY               -->
	<!-- ******************************** -->
	<xsl:template name="main-document.body">
		<xsl:param name="document-to"/>
		<fo:flow flow-name="xsl-region-body">
			<fo:table width="200mm" border-collapse="collapse" table-layout="fixed"
				border-color="black" border-style="solid" border-width="0.5pt">
				<fo:table-column column-width="85mm"/>
				<fo:table-column column-width="15mm"/>
				<fo:table-column column-width="20mm"/>
				<fo:table-column column-width="25mm"/>
				<fo:table-column column-width="15mm"/>
				<fo:table-column column-width="25mm"/>
				<fo:table-column column-width="15mm"/>
				<fo:table-header>
					<fo:table-row>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">Descrizione</fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">U.M.</fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold"
								>Quantit<xsl:text disable-output-escaping="yes">&#38;#224;</xsl:text></fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">Prezzo</fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">Sconto</fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-right-color="black" border-right-style="solid"
							border-right-width="0.5pt" border-bottom-color="black"
							border-bottom-style="solid" border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">Importo netto</fo:block>
						</fo:table-cell>
						<fo:table-cell background-color="rgb(192, 192, 192)"
							border-bottom-color="black" border-bottom-style="solid"
							border-bottom-width="0.5pt">
							<fo:block font-family="Courier" font-size="8pt" text-align="left"
								margin-left="1mm" font-weight="bold">Iva</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-header>
				<fo:table-body>

					<xsl:for-each select="voci-fattura/voce-fattura">

						<fo:table-row  pause-after="true">
							
							<fo:table-cell border-right-color="black" border-right-style="solid"   keep-together.within-column="always"
								border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="left"
									margin-left="2mm" margin-right="2mm"
									white-space-collapse="false" linefeed-treatment="preserve">
									<xsl:value-of disable-output-escaping="yes"
										select="./descrizione"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="left"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes"
										select="./unitaMisura"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes" select="./qta"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes" select="./importo"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes"
										select="./scontoIncr"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="10pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes"
										select="./importoTot"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after"   keep-together.within-column="always">
								<fo:block font-family="Times" font-size="10pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:value-of disable-output-escaping="yes" select="./aliquota"
									/>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
						
						<xsl:choose>
							<xsl:when test="../../aggiungi-interlinea='true'">
								<fo:table-row>
							<fo:table-cell border-right-color="black" border-right-style="solid"   keep-together.within-column="always"
								border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="left"
									margin-left="2mm" margin-right="2mm"
									white-space-collapse="false" linefeed-treatment="preserve">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="left"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after" border-right-color="black"   keep-together.within-column="always"
								border-right-style="solid" border-right-width="0.5pt">
								<fo:block font-family="Times" font-size="5pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell display-align="after"   keep-together.within-column="always">
								<fo:block font-family="Times" font-size="5pt" text-align="right"
									margin-left="2mm" margin-right="2mm">
									<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
						</xsl:when>
						</xsl:choose>
						
						
						
						
					</xsl:for-each>
				</fo:table-body>
			</fo:table>
			<fo:block font-family="Times" font-size="1pt">
				<fo:marker marker-class-name="totale">
					<xsl:text disable-output-escaping="yes">&#38;#8364;&#38;#160;</xsl:text>
					<xsl:value-of disable-output-escaping="yes" select="/fattura/totali/totale"/>
				</fo:marker>
				<fo:marker marker-class-name="contr-conai">
					<xsl:text disable-output-escaping="yes">Contributo CONAI assolto ove dovuto</xsl:text>
				</fo:marker>
				<fo:marker marker-class-name="imponibile">
					<xsl:for-each select="sommario/dett-sommario">
						<fo:block font-family="Times" font-size="10pt" text-align="right">
							<xsl:value-of disable-output-escaping="yes" select="./imponibile"/>
						</fo:block>
					</xsl:for-each>
				</fo:marker>
				<fo:marker marker-class-name="aliquota">
					<xsl:for-each select="sommario/dett-sommario">
						<fo:block font-family="Times" font-size="10pt" text-align="right">
							<xsl:value-of disable-output-escaping="yes" select="./aliquota"/>
						</fo:block>
					</xsl:for-each>
				</fo:marker>
				<fo:marker marker-class-name="esenzione">
					<xsl:for-each select="sommario/dett-sommario">
						<fo:block font-family="Times" font-size="10pt" text-align="right">
							<xsl:value-of disable-output-escaping="yes" select="./esenzione"/>
						</fo:block>
					</xsl:for-each>
				</fo:marker>
				<fo:marker marker-class-name="importo">
					<xsl:for-each select="sommarioEsenti/sommarioEsentiDett">
						<fo:block font-family="Times" font-size="10pt" text-align="right">
							<xsl:value-of disable-output-escaping="yes" select="./importo"/>
						</fo:block>
					</xsl:for-each>
				</fo:marker>
				<fo:marker marker-class-name="causale">
					<xsl:for-each select="sommarioEsenti/sommarioEsentiDett">
						<fo:block font-family="Times" font-size="10pt" text-align="left"
							margin-left="2mm">
							<xsl:value-of disable-output-escaping="yes" select="./causale"/>
						</fo:block>
					</xsl:for-each>
				</fo:marker>
			</fo:block>
			<xsl:if test="$document-to='' or $document-to='ORIGINALE'">
				<fo:block id="totalPageNumber"/>
			</xsl:if>
		</fo:flow>
	</xsl:template>
	<!-- ******************************** -->
	<!--               FOOTER             -->
	<!-- ******************************** -->
	<xsl:template name="main-document.footer">
		<xsl:param name="document-to"/>
		<xsl:param name="color"/>
		<fo:static-content flow-name="xsl-region-after">
			<fo:table width="200mm" table-layout="fixed" height="50mm" border-color="black"
				border-style="solid" border-width="0.5pt">
				<fo:table-column column-width="200mm"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed"
								background-color="rgb(192, 192, 192)">
								<fo:table-column column-width="30mm"/>
								<fo:table-column column-width="20mm"/>
								<fo:table-column column-width="30mm"/>
								<fo:table-column column-width="120mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-right-color="black"
											border-right-style="solid" border-right-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="8pt"
												margin-left="1mm" font-weight="bold"
												text-align="center">Imponibile</fo:block>
										</fo:table-cell>
										<fo:table-cell border-right-color="black"
											border-right-style="solid" border-right-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="8pt"
												margin-left="1mm" font-weight="bold"
												text-align="center">%iva</fo:block>
										</fo:table-cell>
										<fo:table-cell border-right-color="black"
											border-right-style="solid" border-right-width="0.5pt"
											border-bottom-color="black" border-bottom-style="solid"
											border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="8pt"
												margin-left="1mm" font-weight="bold"
												text-align="center">Importo iva</fo:block>
										</fo:table-cell>
										<fo:table-cell border-bottom-color="black"
											border-bottom-style="solid" border-bottom-width="0.5pt">
											<fo:block font-family="Courier" font-size="8pt"
												text-align="center">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row height="20mm">
						<fo:table-cell>
							<fo:table width="200mm" height="20mm" table-layout="fixed">
								<fo:table-column column-width="30mm"/>
								<fo:table-column column-width="20mm"/>
								<fo:table-column column-width="30mm"/>
								<fo:table-column column-width="120mm"/>
								<fo:table-body>
									<xsl:choose>
										<xsl:when test="count(sommario/dett-sommario) = 0">
											<fo:table-row keep-together="always" height="20mm">
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:block font-family="Times" font-size="8pt"
												text-align="right">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
												</fo:block>
												</fo:table-cell>
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:block font-family="Times" font-size="8pt"
												text-align="right">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
												</fo:block>
												</fo:table-cell>
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:block font-family="Times" font-size="8pt"
												text-align="right">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
												</fo:block>
												</fo:table-cell>
												<fo:table-cell>
												<fo:block font-family="Courier" font-size="8pt"
												text-align="center">
												<fo:retrieve-marker
												retrieve-class-name="contr-conai"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</xsl:when>
										<xsl:otherwise>
											<fo:table-row keep-together="always" height="20mm">
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:retrieve-marker
												retrieve-class-name="imponibile"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:table-cell>
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:retrieve-marker
												retrieve-class-name="aliquota"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:table-cell>
												<fo:table-cell border-right-color="black"
												border-right-style="solid"
												border-right-width="0.5pt">
												<fo:retrieve-marker
												retrieve-class-name="esenzione"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:table-cell>
												<fo:table-cell>
												<fo:block font-family="Courier" font-size="10pt"
												text-align="center">
												<fo:retrieve-marker
												retrieve-class-name="contr-conai"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</xsl:otherwise>
									</xsl:choose>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="110mm"/>
								<fo:table-column column-width="50mm"/>
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-top-color="black"
											border-top-style="solid" border-top-width="0.5pt"
											background-color="rgb(192, 192, 192)">
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="center"
												margin-left="1mm">Importo esenzione iva</fo:block>
										</fo:table-cell>
										<fo:table-cell border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-top-color="black" border-top-style="solid"
											border-top-width="0.5pt"
											background-color="rgb(192, 192, 192)">
											<fo:block font-family="Courier" font-size="8pt"
												font-weight="bold" text-align="left"
												margin-left="1mm">Causale esente</fo:block>
										</fo:table-cell>
										<fo:table-cell border-left-color="black"
											border-left-style="solid" border-left-width="0.5pt"
											border-top-color="black" border-top-style="solid"
											border-top-width="0.5pt"
											background-color="rgb(192, 192, 192)">
											<fo:block font-family="Times" font-size="8pt"
												text-align="left"> Totale
												documento/s.e.<xsl:text disable-output-escaping="yes">&#38;#38;</xsl:text> o.</fo:block>
										</fo:table-cell>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:table width="200mm" table-layout="fixed">
								<fo:table-column column-width="40mm"/>
								<fo:table-column column-width="110mm"/>
								<fo:table-column column-width="50mm"/>
								<fo:table-body>
									<fo:table-row height="20mm">
										<xsl:choose>
											<xsl:when
												test="count(sommarioEsenti/sommarioEsentiDett) = 0">
												<fo:table-cell border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:block font-family="Times" font-size="8pt"
												text-align="right">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
												</fo:block>
												</fo:table-cell>
												<fo:table-cell border-left-color="black"
												border-left-style="solid"
												border-left-width="0.5pt"
												border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:block font-family="Times" font-size="8pt"
												text-align="left" margin-left="2mm">
												<xsl:text disable-output-escaping="yes">&#38;#160;</xsl:text>
												</fo:block>
												</fo:table-cell>
												<fo:table-cell display-align="center"
												border-left-color="black"
												border-left-style="solid"
												border-left-width="0.5pt"
												border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:block font-family="Times" font-size="14pt"
												margin-top="5mm" text-align="center"
												font-weight="bold">
												<fo:retrieve-marker
												retrieve-class-name="totale"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:block>
												</fo:table-cell>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-cell border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:retrieve-marker
												retrieve-class-name="importo"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:table-cell>
												<fo:table-cell border-left-color="black"
												border-left-style="solid"
												border-left-width="0.5pt"
												border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:retrieve-marker
												retrieve-class-name="causale"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page-sequence"/>
												</fo:table-cell>
												<fo:table-cell display-align="center"
												border-left-color="black"
												border-left-style="solid"
												border-left-width="0.5pt"
												border-top-color="black"
												border-top-style="solid"
												border-top-width="0.5pt">
												<fo:block font-family="Times" font-size="14pt"
												margin-top="5mm" text-align="center"
												font-weight="bold">
												<fo:retrieve-marker
												retrieve-class-name="totale"
												retrieve-position="last-ending-within-page"
												retrieve-boundary="page"/>
												</fo:block>
												</fo:table-cell>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table-row>
								</fo:table-body>
							</fo:table>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
			<fo:table width="200mm" height="18mm" table-layout="fixed">
				<fo:table-column column-width="200mm"/>
				<fo:table-body>
					<fo:table-row>
						
							
							<xsl:choose>
								<xsl:when test="multiple-copies='false'">
									<fo:table-cell >	
									<fo:block font-family="Courier" font-size="10pt" font-weight="bold"
										text-align="left" margin-right="1mm"><xsl:value-of disable-output-escaping="yes" select="$document-to"/>
									</fo:block>
									</fo:table-cell>
								</xsl:when>
								<xsl:otherwise>
								 
									<xsl:choose>
									<xsl:when test="have-color='false'">
										<fo:table-cell >	
											<fo:block font-family="Courier" font-size="10pt" font-weight="bold"
												text-align="left" margin-right="1mm"><xsl:value-of disable-output-escaping="yes" select="$document-to"/>
											</fo:block>
										</fo:table-cell>
										
									</xsl:when>
									<xsl:otherwise>
										
								
									<xsl:choose>
										<xsl:when  test="$color = 0">
											<fo:table-cell >	
												<fo:block font-family="Courier" font-size="10pt" font-weight="bold"
													text-align="left" margin-right="1mm"><xsl:value-of disable-output-escaping="yes" select="$document-to"/>
												</fo:block>
											</fo:table-cell>
										</xsl:when>
									</xsl:choose>
									
									<xsl:choose>
										<xsl:when  test="$color = 1">
											<fo:table-cell color="rgb(99,184,255)">	
												<fo:block font-family="Courier" font-size="10pt" font-weight="bold"
													text-align="left" margin-right="1mm"><xsl:value-of disable-output-escaping="yes" select="$document-to"/>
												</fo:block>
											</fo:table-cell>
										</xsl:when>
										</xsl:choose>
											
									<xsl:choose>
										<xsl:when  test="$color = 2">
											<fo:table-cell color="rgb(255,192,203)">	
												<fo:block font-family="Courier" font-size="10pt" font-weight="bold"
													text-align="left" margin-right="1mm"><xsl:value-of disable-output-escaping="yes" select="$document-to"/>
												</fo:block>
											</fo:table-cell>
										</xsl:when>
									</xsl:choose>
									</xsl:otherwise>
										</xsl:choose>
								</xsl:otherwise>
							</xsl:choose>

					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</fo:static-content>
	</xsl:template>

</xsl:stylesheet>
