Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Controllare-Validare file XML by Vba

537 views
Skip to first unread message

mauriz...@infinito.it

unread,
Jan 30, 2019, 10:02:58 AM1/30/19
to
Ciao a tutti,

tramite VBA è possibile controllare la bontà di un file xml?

Come avviene qui: https://sdi.fatturapa.gov.it/SdI2FatturaPAWeb/AccediAlServizioAction.do?pagina=controlla_fattura

p.s. l'intento è evitare il captha dell'ADE.

Grazie Maurizio

buonoc...@gmail.com

unread,
Jan 30, 2019, 12:00:45 PM1/30/19
to
Devi avere il file di estensione .xsd con lo 'schema' del file xml cioè un file che memorizza il tipo di dati del file xml e eventuali convalide (intervallo valori per es)
Ci sono librrie vba ch epoi si incaricano di validare il file xml in funzione del file .xsd. Qui un esempio tra i tanti che trovi sul web:
https://stackoverflow.com/questions/47010877/vba-code-to-validate-xml-using-xsd-files-and-retrieving-all-validation-errors-in?noredirect=1&lq=1

casanmaner

unread,
Jan 30, 2019, 1:37:48 PM1/30/19
to
Occorre per "ripulire" il file dello schema xsd della fattura elettronica dai riferimenti allo schema della firma:

Quindi scaricare il file xsd fornito dall'AdE e modificarlo tramite un editor eliminando queste stringhe:

xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" />

<xs:element ref="ds:Signature" minOccurs="0" />

Diversamente objSchemaCache.Add dà errore per incongruenze negli schemi.

Magari studiando un po' si riesce a lavorare sul file originale, ma va un po' oltre le mie nozioni :)

casanmaner

unread,
Jan 30, 2019, 1:47:10 PM1/30/19
to
Ho anche provato ad impostare:

.resolveExternals = True

ma viene dato errore perché non viene consentita un'azione (la DTD) non viene consentita quando la procedura cerca di caricare lo schema
http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd

mauriz...@infinito.it

unread,
Jan 30, 2019, 2:53:16 PM1/30/19
to
Grazie delle info, anche se la vedo dura!

casanmaner

unread,
Jan 30, 2019, 5:04:34 PM1/30/19
to
Ho provato a capirci un po' e non è facile cercando di carpire solo aspetti parziali e per lo più in inglese :)
Ma prova a vedere come si comportano queste procedure presenti in questo file:

https://www.dropbox.com/s/csgh3w6qubp3oqv/Valida%20Xml%20FE.xlsm?dl=0

La verifica dello schema viene fatta sulla base dello schema xsd AdE modificato come dicevo nel precedente post.
Se vuoi qui trovi il file xsd modificato:

https://www.dropbox.com/s/yh32qu29mslmcks/Schema_VFPR12_mod.xsd?dl=0

Dovrai modificare la costante:
Const sFileXsdFullName As String = "D:\Dropbox\Microsoft it office excel\Schema_VFPR12_mod.xsd"

per inserire il percorso dove salverai il file xsd.

Nel modulo1 ho inserito questo codice che rappresenta un adattamento di quanto presente nel link che ha segnalato Elio.

Option Explicit

'PROCEDURE PER VALIDAZIONE FILE XML

Sub SelezionaFileEVerificaSchema()
Dim vSelectedItem As Variant
With Application.FileDialog(msoFileDialogFilePicker)
With .Filters
.Clear
.Add "file xml", "*.xml"
End With
.AllowMultiSelect = True
If .Show = -1 Then
For Each vSelectedItem In .SelectedItems
Call ValidaXmlFE(CStr(vSelectedItem))
Next vSelectedItem
End If
End With
End Sub

Sub ValidaXmlFE(sFileXmlFullName As String)
Const sFileXsdFullName As String = "D:\Dropbox\Microsoft it office excel\Schema_VFPR12_mod.xsd"
Const sTargetNameSpace = "http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"
Dim objSchemaCache As New MSXML2.XMLSchemaCache60
Dim objErr As MSXML2.IXMLDOMParseError2
Dim oErr As MSXML2.IXMLDOMParseError
Dim arrErrori() As Variant
Dim sFileName As String
Dim i As Long
sFileName = Mid(sFileXmlFullName, InStrRev(sFileXmlFullName, "\") + 1)
objSchemaCache.Add sTargetNameSpace, CaricaXml(sFileXsdFullName)
With CaricaXml(sFileXmlFullName)
Set .Schemas = objSchemaCache
.setProperty "MultipleErrorMessages", True
Set objErr = .Validate()
End With
For Each oErr In objErr.allErrors
i = i + 1
ReDim Preserve arrErrori(1 To i)
arrErrori(i) = oErr.reason
Next oErr
If i > 0 Then
MsgBox "Verifica del file: " & sFileName & vbNewLine & _
"Sono stati rilevati i seguenti errori nello schema:" & String(2, vbNewLine) & _
Join(arrErrori, vbNewLine), vbInformation, "REPORT ERRORI"
Else
MsgBox "Verifica del file: " & sFileName & vbNewLine & _
"Non sono stati rilevati errori nello schema.", vbInformation, "REPORT ERRORI"
End If
End Sub

Function CaricaXml(sFileFullName As String) As MSXML2.DOMDocument60
Set CaricaXml = New MSXML2.DOMDocument60
With CaricaXml
.async = False
.validateOnParse = False
.resolveExternals = False
.Load sFileFullName
End With
End Function



Quando clicchi sul pulsante presente nel foglio si apre una finestra di dialogo tramite la quale puoi selezionare uno o più xml per ciascuno dei quali verrà eseguita la verifica.

Prova a vedere se in qualche modo può essere di aiuto.
Per me è difficile riuscire a fare qualcosa di più con le scarse nozioni che ho su queste cose.

ciao

p.s. nel file ho aggiunto, nel progetto VBA, il riferimento alla libreria Microsoft XML, v3.0

Bruno Campanini

unread,
Jan 30, 2019, 8:30:12 PM1/30/19
to
casanmaner was thinking very hard :

> Ho provato a capirci un po' e non è facile cercando di carpire solo aspetti
> parziali e per lo più in inglese :) Ma prova a vedere come si comportano
> queste procedure presenti in questo file:
>
> https://www.dropbox.com/s/csgh3w6qubp3oqv/Valida%20Xml%20FE.xlsm?dl=0
> [...]

Ci sto lavorando anch'io, spero che il tuo lavoro mi faccia
risparmiare un po' di tempo.

1 - nel progetto vi sono procedure/parametri che richiedono
Microsoft XML, v6.0 e non 3.0
2 - ti do 100 lire se rendi visibile la chiamata sotto il
quadrettone.

Il tuo file XLM, con lievi modifiche da me funziona.

https://1drv.ms/x/s!AvTaMfd5-b2osw5F6bf4hXYG3bGa

Bruno

mauriz...@infinito.it

unread,
Jan 31, 2019, 2:06:54 AM1/31/19
to
Grazie del vs solerte ed efficace lavoro Casanmaner e Bruno !!!

mauriz...@infinito.it

unread,
Jan 31, 2019, 7:53:19 AM1/31/19
to
Ribadendo lo straordinario lavoro di Casanmaner sulla procedura di ctrl del formato xml purtroppo il controllo non prevede un ctrl numerico (cioè che 1000+220 fa 1220 e non 1221) come opera invece: https://sdi.fatturapa.gov.it/SdI2FatturaPAWeb/AccediAlServizioAction.do?pagina=controlla_fattura

casanmaner

unread,
Jan 31, 2019, 8:02:27 AM1/31/19
to
Quei controlli esulano il formato.
Non avrai nemmeno un controllo sulla esistenza della partita iva, sulla esistenza del codice fiscale, sulla esistenza di un codice destinatario.

In pratica quei controlli servono solo a verificare che l'xml sia correttamente "formattato".


Per fare un contollo completo io mi logino in Fatture e Corrispettivi e utilizzo l'apposita funzionalità prevista per il controllo della trasmissione al SDI.
Controllo che esegue anche le ulteriori verifiche specifiche perché lo SDI non scarti il file.

Per poter fare i controlli di cui tu dici occorrerebbe implemetare delle verifiche ad hoc.
Ma comunque alcuni controlli sarebbero pressoché impossibili perché ad es. per verificare se una partita iva è esistente occorrerebbe accedere ad un data base che l'AdE non rende disponibile (se non tramite il sito AdE ma non iserimento della CAPTCHA).


mauriz...@infinito.it

unread,
Jan 31, 2019, 10:44:58 AM1/31/19
to
Grazie.

casanmaner

unread,
Jan 31, 2019, 11:06:57 AM1/31/19
to
Prego ... comunque questo tipo di controllo potrebbe risultare utile al momento in cui formi il file.
Almeno hai una verifica che sia "formattato" in maniera corretta evitando almeno quel tipo di errori.
Non ho provato ad inserire caratteri "vietati" (non convertiti) ma probabilmente la cosa verrebbe "intercettata".
Faccio una prova :)

casanmaner

unread,
Jan 31, 2019, 11:11:48 AM1/31/19
to
Provato inserendo una lettera accentata ("Attività") e viene dato questo errore:
https://www.dropbox.com/s/l66y1lhxi9o3nrn/Screenshot%202019-01-31%2017.09.35.png?dl=0

Bruno Campanini

unread,
Jan 31, 2019, 12:26:50 PM1/31/19
to
casanmaner formulated the question :

>> Prego ... comunque questo tipo di controllo potrebbe risultare utile al
>> momento in cui formi il file. Almeno hai una verifica che sia "formattato"
>> in maniera corretta evitando almeno quel tipo di errori. Non ho provato ad
>> inserire caratteri "vietati" (non convertiti) ma probabilmente la cosa
>> verrebbe "intercettata". Faccio una prova :)
>
> Provato inserendo una lettera accentata ("Attività") e viene dato questo
> errore:
> https://www.dropbox.com/s/l66y1lhxi9o3nrn/Screenshot%202019-01-31%2017.09.35.png?dl=0

Ma dove l'hai messa Attività?
Io l'ho messa nella denominazione e il risultato è ancora buono.

Bruno

casanmaner

unread,
Jan 31, 2019, 12:55:52 PM1/31/19
to
Nella causale di un file xml salvato in "ANSI" ho scritto "Attività di consulenza".
E viene dato quell'errore.
Se lo stesso file lo salvo in formato UTF-8 invece il controllo viene superato perché salvando in quel formato molti caratteri speciali vengono riconosciuti.

casanmaner

unread,
Jan 31, 2019, 1:00:35 PM1/31/19
to
Piuttosto ho provato a caricare nella cartella di lavoro il file xmd.
In tal modo ad es. sono disponibili:
Il namespace: ThisWorkbook.XmlMaps(1).Schemas(1).Namespace
e l'intero XML: ThisWorkbook.XmlMaps(1).Schemas(1).XML

ma provando ad assegnare questi parametri a:
objSchemaCache.Add ThisWorkbook.XmlMaps(1).Schemas(1).Namespace, ThisWorkbook.XmlMaps(1).Schemas(1).XML

ricevo questo errore:
https://www.dropbox.com/s/m5nr72j0wsl94p0/Screenshot%202019-01-31%2018.59.11.png?dl=0

L'idea sarebbe quella di avere a disposizione nella cartella di lavoro lo schema xsd senza doverlo caricare da un file esterno.
Però non sono riuscito a risolvere la cosa.
Se qualcuno avesse una intuizione potrebbe essere utile :)

Bruno Campanini

unread,
Jan 31, 2019, 3:18:14 PM1/31/19
to
casanmaner was thinking very hard :
Fammi capire, lo "schema xsd" di cui parli è quel file
Schema_VFPR12_mod.xsd che tu hai modificato?

O intendi quel che si deve attingere da:
"http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"?

Il primo io l'ho messo nel mio HD, e da lì lo utilizzo.
Quel che si utilizza da "http://ivaservizi.agenziaentrate..."
tu sai cos'è?
Un file, un processo...?
Tu parli di intuizione, ma quell'"http://ivaservizi.agenziaentrate..."
lo trovi nella fattura e nell'XSD e li ti tocca andare, anche
se tu avessi in tasca il file che lì si trova.

Io son cinque giorni che ci metto le mani su 'sta roba XML,
e mi sembra che non sia una gran specialità.
Oltrettutto non puoi far niente di serio se non sei online.
Se poi guardi la stampa della FE (quella completa) che puoi
ottenere da F&C, nella quale si legge che è prodotta con
foglio di stile SdI www.fatturapa.gov.it... c'è da mettersi
le mani nei capelli!

Finora la cosa migliore, esteticamente, che ho trovato è la
fattura che ti stampa lo Stand Olone Fatturazione dell'ADE.

Bruno

casanmaner

unread,
Jan 31, 2019, 6:24:03 PM1/31/19
to
> Fammi capire, lo "schema xsd" di cui parli è quel file
> Schema_VFPR12_mod.xsd che tu hai modificato?

Ciao Bruno,
sì parlo dello schema xsd.
Ho caricato in una cartella di lavoro quello schema in modo che sia disponibile.
Vedi questi tre screen:
https://www.dropbox.com/s/lu1fbag6q4cr9wr/Screenshot%202019-01-31%2023.51.51.png?dl=0

https://www.dropbox.com/s/ntt29z24vcprpc9/Screenshot%202019-01-31%2023.51.55.png?dl=0

https://www.dropbox.com/s/o6cu2v8r8qga8mk/Screenshot%202019-01-31%2023.52.00.png?dl=0

come puoi vedere dall'ultimo screen lo schema è disponibile nella cartella di lavoro.
Volendo potresti mappare le celle con le voci che ti interessano per avere uno schema di fattura nel foglio excel (anche se non era questo il mio scopo).

Una volta caricato lo schema si possono ricavare alcune informazioni.
Ad es. con:
ThisWorkbook.XmlNamespaces(1).Uri

ottieni: http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2

che è il "name space" che viene assegnato al primo argomento della "SchemaCache".

Ad es. con:
ThisWorkbook.XmlMaps(1).Schemas(1).XML
si ottiene l'intero schema XMl che è quello che in teoria viene assegnato, tramite il caricamento del file xsd (il cui contenuto viene assegnato al domdocument).

Vedi questo file excel:
https://www.dropbox.com/s/hxs1jkgob5foaye/Test%20Schema%20FE.xlsm?dl=0
ci sono due pulsanti.
Il primo apre un semplice msgbox con il "namespace" (la url).
Il secondo apre una userform con un textbox dove viene inserito lo schema xml.


La mia idea era quella di assegnare all'oggetto dichiarato:
Dim objSchemaCache As New MSXML2.XMLSchemaCache60

e così valorizzato:
objSchemaCache.Add sTargetNameSpace, CaricaXml(sFileXsdFullName)

in luogo della prima costante il name space prelevato dallo schema presente nella cartella di lavoro (ThisWorkbook.XmlNamespaces(1).Uri)

In luogo del domdocument contenente lo schema xml direttamente lo schema prelevato dalla cartella di lavoro con:
ThisWorkbook.XmlMaps(1).Schemas(1).XML

Ma appunto questo passaggio non va a buon fine e dà quell'errore.

Questo allo scopo di rendere la cartella di lavoro autonoma da un file esterno di cui occorre predeterminare la posizione.

Al momento ho risolto creandomi la stringa di testo in base64.
Ho salvato la stessa, dopo aver diviso la stringa in tre parti più piccole, in tre celle del foglio di lavoro.
Prima di lanciare la procedura che carica lo schema viene creato nella cartella Temp di "sistema" un file decodificando da base64 a binario e facendo riferimento a quel file (che alla fine della procedura viene cancellato).

Ma mi piacerebbe capire perché l'idea di utilizzare lo schema xml direttamente dalla cartella non funzioni.
Ma non so se ci riuscirò :)

ciao

Bruno Campanini

unread,
Feb 1, 2019, 6:17:12 AM2/1/19
to
casanmaner explained on 01-02-19 :
Evidentemente objSchemaCache.Add accetta come primo parametro
un valore determinato ByVal e non ByRef.
Infatti viene prima definito
Const Const XSD_SchemaNameSpace = "http://ivaservizi..." e così
objSchemaCache.Add l'accetta.
Se togli Const l'assegnazione a XSD_SchemaNameSpace avviene
ByRef e objSchemaCache.Add non l'accetta più.

Insomma objSchemaCache.Add accetta il valore "http://iva..."
ovvero una variabile alla quale detto valore sia stato assegnato
ByVal (Const) e non ByRef (che è il defaiult per VBA).

Comunque complimenti, stai facendo un gran lavorono!

Noto ora che il programma s'inceppa su objSchemaCache.Add...
come se http://ivaservizi... non desse più udienza.

Bruno

casanmaner

unread,
Feb 1, 2019, 8:18:53 AM2/1/19
to
Il giorno venerdì 1 febbraio 2019 12:17:12 UTC+1, Bruno Campanini ha scritto:
>
> Evidentemente objSchemaCache.Add accetta come primo parametro
> un valore determinato ByVal e non ByRef.
> Infatti viene prima definito
> Const Const XSD_SchemaNameSpace = "http://ivaservizi..." e così
> objSchemaCache.Add l'accetta.
> Se togli Const l'assegnazione a XSD_SchemaNameSpace avviene
> ByRef e objSchemaCache.Add non l'accetta più.
>
> Insomma objSchemaCache.Add accetta il valore "http://iva..."
> ovvero una variabile alla quale detto valore sia stato assegnato
> ByVal (Const) e non ByRef (che è il defaiult per VBA).
>
Ho provato ad assengare solo come costante il primo parametro ma assegnando al secondo l'XML "prelevato" dallo schema inserito nella cartella di lavoro ma l'errore viene dato ugualmente.
Quindi non so se dipenda nello specifico dal fatto che il primo paramentro viene accettato solo come byVal.


Comunque se volete qui c'è la versione che non necessita del file xsd salvato nel proprio disco fisso andando a creare il file al momento in cui si lancia la procedura.
A differenza di quanto detto in un precedente intervento però non uso la stringa di testo "base64" per creare poi il file "deconvertendola in "binary".
Ho optato, invece, nel caricare lo schema xsd (sempre quello modificato) nella cartella di lavoro e utilizzare il relativo schema XML per "scriverlo" nel corpo del file che viene salvato in formato UTF-8.
Diversamente non viene letto correttamente e objSchemaCache.Add dà errore. E magari l'errore dipende dal fatto che il testo dello schema XML deve essere codificato in UTF-8 (ma è solo un'ipotesi che azzardo).

Il file ha il primo foglio protetto ma è senza password (giusto per avere disponibile solo il pulsantone :) ).

https://www.dropbox.com/s/31epz15cgw6kmrj/Valida%20Xml%20FE%20%28Schema%20XML%20in%20Wb%29.xlsm?dl=0

Bruno Campanini

unread,
Feb 1, 2019, 11:58:58 AM2/1/19
to
casanmaner presented the following explanation :
> Il giorno venerdì 1 febbraio 2019 12:17:12 UTC+1, Bruno Campanini ha scritto:
>>
>> Evidentemente objSchemaCache.Add accetta come primo parametro
>> un valore determinato ByVal e non ByRef.
>> Infatti viene prima definito
>> Const Const XSD_SchemaNameSpace = "http://ivaservizi..." e così
>> objSchemaCache.Add l'accetta.
>> Se togli Const l'assegnazione a XSD_SchemaNameSpace avviene
>> ByRef e objSchemaCache.Add non l'accetta più.
>>
>> Insomma objSchemaCache.Add accetta il valore "http://iva..."
>> ovvero una variabile alla quale detto valore sia stato assegnato
>> ByVal (Const) e non ByRef (che è il defaiult per VBA).
>>
> Ho provato ad assengare solo come costante il primo parametro ma assegnando
> al secondo l'XML "prelevato" dallo schema inserito nella cartella di lavoro
> ma l'errore viene dato ugualmente. Quindi non so se dipenda nello specifico
> dal fatto che il primo paramentro viene accettato solo come byVal.
>
>
> Comunque se volete qui c'è la versione che non necessita del file xsd salvato
> nel proprio disco fisso andando a creare il file al momento in cui si lancia
> la procedura.
Allora il file Schema_VFPR12_mod.xsd non serve più?
Infatti non l'ho trovato. Ti sei messo a fare il prestigiatore?

Bruno

casanmaner

unread,
Feb 1, 2019, 12:00:39 PM2/1/19
to
Il giorno venerdì 1 febbraio 2019 17:58:58 UTC+1, Bruno Campanini ha scritto:

> Allora il file Schema_VFPR12_mod.xsd non serve più?
> Infatti non l'ho trovato. Ti sei messo a fare il prestigiatore?
>
La procedura lo crea e poi lo "killa".
Viene creato nella cartella Temp dell'utente attivo.


draleo

unread,
Feb 3, 2019, 4:40:39 AM2/3/19
to
Ho cercato di seguire il post, ma con tutte quelle sigle e acronimi vari, non ho capito a cosa possa servire. Allora chiedo: questa procedura e quella di Bruno di un altro post, serve a tradurre la fattura elettronica (quella che si riceve sulla mail certificata) in un qualcosa di leggibile ?(PDF?). Se fosse così potrebbe servirmi. Grazie

draleo

casanmaner

unread,
Feb 3, 2019, 4:47:35 AM2/3/19
to
Ciao Draleo,
no in particolare questa procedura verifica, dopo aver creato un file xml contenente i dati della fattura elettronica, se lo stesso file è "formalmente corretto", cioé se rispetta le specifiche previste per il formato fattura elettronica.

Per la visualizzazione delle fatture occorre affidarsi ai c.d. "fogli di stile" di cui però personalmente non ho ben capito come "associarli" ma soprattutto, almeno per me, è difficile realizzarne uno "personale".
Per farti capire questo è il testo di un foglio di stile per visualizzare i file secondo lo schema proposto da Assosoftware

<?xml version="1.0"?>
<xsl:stylesheet
version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b="http://www.fatturapa.gov.it/sdi/fatturapa/v1.1"
xmlns:c="http://www.fatturapa.gov.it/sdi/fatturapa/v1.0"
xmlns:a="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"
xmlns:d="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.0">

<xsl:output method="html" />
<xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>

<xsl:template name="FormatDateIta">
<xsl:param name="DateTime" />

<xsl:variable name="year" select="substring($DateTime,1,4)" />
<xsl:variable name="month" select="substring($DateTime,6,2)" />
<xsl:variable name="day" select="substring($DateTime,9,2)" />

<xsl:value-of select="$day" />
<xsl:value-of select="'-'" />
<xsl:value-of select="$month" />
<xsl:value-of select="'-'" />
<xsl:value-of select="$year" />

</xsl:template>

<xsl:template name="FormatIVA">
<xsl:param name="Natura" />
<xsl:param name="IVA" />
<xsl:choose>
<xsl:when test="$Natura">
<xsl:value-of select="$Natura" />
</xsl:when>
<xsl:otherwise>
<xsl:if test="$IVA">
<xsl:value-of select="format-number($IVA, '###.###.##0,00', 'euro')" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="FormatSconto">
<xsl:param name="tipo" />
<xsl:param name="percentuale" />
<xsl:param name="importo" />

<xsl:choose>
<xsl:when test="$tipo = 'SC' ">
<xsl:text>-</xsl:text>
</xsl:when>
<xsl:when test="$tipo = 'MG'">
<xsl:text>+</xsl:text>

</xsl:when>
<xsl:otherwise>

</xsl:otherwise>
</xsl:choose>


<xsl:choose>
<xsl:when test="$percentuale">
<xsl:value-of select="$percentuale" />
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$importo">
<xsl:value-of select="format-number($importo, '###.###.##0,00', 'euro')" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>

</xsl:template>

<xsl:template name="FormatColSconto">
<xsl:param name="tipo" />
<xsl:param name="percentuale" />
<xsl:param name="importo" />

<xsl:choose>
<xsl:when test="$tipo = 'SC' ">
<xsl:text>-</xsl:text>
</xsl:when>
<xsl:when test="$tipo = 'MG'">
<xsl:text>+</xsl:text>

</xsl:when>
<xsl:otherwise>

</xsl:otherwise>
</xsl:choose>


<xsl:choose>
<xsl:when test="$percentuale">
<xsl:value-of select="$percentuale" />
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$importo">
<xsl:value-of select="format-number($importo, '###.###.##0,00', 'euro')" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>

</xsl:template>


<xsl:template match="DettaglioLinee">
<xsl:param name="r" />
<xsl:param name="posASWRELSTD" />
<!--Pre LINEA OpzPreLineaDatiDDT -->
<xsl:for-each select="OpzPreLineaDatiDDT" >
<xsl:call-template name="AltraDescrizioneLinea">
<xsl:with-param name="textDescrizione" select = "." />
</xsl:call-template>
</xsl:for-each>

<!--Pre LINEA OpzPreLineaDatiOrdineAcquisto -->
<xsl:for-each select="OpzPreLineaDatiOrdineAcquisto" >
<xsl:call-template name="AltraDescrizioneLinea">
<xsl:with-param name="textDescrizione" select = "." />
</xsl:call-template>
</xsl:for-each>

<!--Pre LINEA OpzPreLineaDatiContratto -->
<xsl:for-each select="OpzPreLineaDatiContratto" >
<xsl:call-template name="AltraDescrizioneLinea">
<xsl:with-param name="textDescrizione" select = "." />
</xsl:call-template>
</xsl:for-each>

<!--Pre LINEA OpzPreLineaDatiFattureCollegate -->
<xsl:for-each select="OpzPreLineaDatiFattureCollegate" >
<xsl:call-template name="AltraDescrizioneLinea">
<xsl:with-param name="textDescrizione" select = "." />
</xsl:call-template>
</xsl:for-each>
<!--DETTAGLIO LINEE -->

<xsl:choose>
<xsl:when test="$posASWRELSTD = $r">
<xsl:call-template name="DettaglioLineeASW"/>
</xsl:when>

<xsl:otherwise>


<tr>
<td>
<xsl:for-each select="CodiceArticolo" >
<div class="tx-xsmall">
<xsl:if test="CodiceValore">
<xsl:text> </xsl:text>
<xsl:value-of select="CodiceValore" />
</xsl:if>
<xsl:if test="CodiceTipo">
(<xsl:value-of select="CodiceTipo" />)
</xsl:if>
</div>
</xsl:for-each>
</td>
<td>

<xsl:if test="Descrizione">
<xsl:value-of select="Descrizione" />
</xsl:if>

<xsl:if test="TipoCessionePrestazione">
(<xsl:value-of select="TipoCessionePrestazione" />)
</xsl:if>


<xsl:for-each select="AltriDatiGestionali" >

<xsl:if test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) != 'aswrelstd'
and
translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) != 'aswswhouse'
and
translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) != 'aswtriga' ">


<div class="tx-xsmall">
<xsl:text>Tipo dato: </xsl:text>
<xsl:value-of select="TipoDato" />
<xsl:if test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) = 'aswlottsca' ">
<xsl:text> (dati relativi a lotti e scadenze) </xsl:text>
</xsl:if>

</div>

<xsl:if test="RiferimentoTesto">
<div class="tx-xsmall">
<xsl:choose>
<xsl:when test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) = 'aswlottsca' ">

<xsl:text>Lotto: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Rif. testo: </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="RiferimentoTesto" />
</div>
</xsl:if>



<xsl:if test="RiferimentoData">
<div class="tx-xsmall">
<xsl:choose>
<xsl:when test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) = 'aswlottsca' ">

<xsl:text>Scadenza: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Rif. data: </xsl:text>
</xsl:otherwise>
</xsl:choose>

<xsl:call-template name="FormatDateIta">
<xsl:with-param name="DateTime" select="RiferimentoData" />
</xsl:call-template>

</div>
</xsl:if>

<xsl:if test="RiferimentoNumero">
<div class="tx-xsmall">
<xsl:choose>
<xsl:when test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) = 'aswlottsca' ">

<xsl:text>Quantità del suddetto lotto: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Rif. numero: </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="format-number(RiferimentoNumero, '###.###.##0,########', 'euro')" />
</div>
</xsl:if>



</xsl:if>

</xsl:for-each>

<xsl:if test="RiferimentoAmministrazione">
<div class="tx-xsmall">
RIF.AMM. <xsl:value-of select="RiferimentoAmministrazione" />
</div>
</xsl:if>

</td>



<td class="import2" >
<xsl:if test="Quantita">
<xsl:if test="number(Quantita)">
<xsl:value-of select="format-number(Quantita, '###.###.##0,00######', 'euro')" />
</xsl:if>
</xsl:if>
</td>



<td class="import" >
<xsl:if test="PrezzoUnitario">
<xsl:if test="number(PrezzoTotale)">

<xsl:value-of select="format-number(PrezzoUnitario, '###.###.##0,00######', 'euro')" />
</xsl:if>
</xsl:if>
</td>

<td class="textCenter" >
<xsl:if test="UnitaMisura">
<xsl:value-of select="UnitaMisura" />
</xsl:if>

</td>
<td class="import" >

<xsl:for-each select="ScontoMaggiorazione" >

<div>

<xsl:call-template name="FormatColSconto" >
<xsl:with-param name="tipo" select="Tipo" />
<xsl:with-param name="percentuale" select="Percentuale" />
<xsl:with-param name="importo" select="Importo" />
</xsl:call-template>


</div>
</xsl:for-each>

</td>

<td class="import" >

<xsl:if test="number(PrezzoTotale)">

<xsl:call-template name="FormatIVA">
<xsl:with-param name="Natura" select="Natura" />
<xsl:with-param name="IVA" select="AliquotaIVA" />
</xsl:call-template>
</xsl:if>

</td>
<td>
<xsl:if test="PrezzoTotale">
<xsl:if test="number(PrezzoTotale)">

<div class="import">
<xsl:value-of select="format-number(PrezzoTotale, '###.###.##0,00######', 'euro')" />
</div>
</xsl:if>


<xsl:if test="OpzPrezzoTotale">
<div class="tx-xsmall">
<xsl:value-of select="OpzPrezzoTotale" />
</div>
</xsl:if>
</xsl:if>



</td>




</tr>

</xsl:otherwise>
</xsl:choose>

<!--POST LINEA -->
<xsl:for-each select="OpzPostLinea" >
<xsl:call-template name="AltraDescrizioneLinea">
<xsl:with-param name="textDescrizione" select = "." />
</xsl:call-template>
</xsl:for-each>

</xsl:template>


<xsl:template name="DettaglioLineeASW">
<tr >
<td>
</td>

<td >
<xsl:text>------------------------</xsl:text>
<xsl:for-each select="AltriDatiGestionali" >

<xsl:if test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) != 'aswrelstd'
and
translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) != 'aswswhouse' ">

<div class="tx-xsmall">
<xsl:value-of select="RiferimentoTesto" />
<xsl:text> </xsl:text>
<xsl:value-of select="TipoDato" />
</div>

</xsl:if>

</xsl:for-each>
</td>

<td >
</td>


<td >
</td>
<td >
</td>
<td >
</td>

<td >
</td>
<td >
</td>
</tr>

</xsl:template>

<xsl:template name="AltraDescrizioneLinea">
<xsl:param name = "textDescrizione" />
<!-- testo della descrizione -->
<tr>
<td >
</td>

<td >
<div class="tx-xsmall">
<xsl:value-of select="$textDescrizione" />
</div>
</td>

<td>
</td>


<td>
</td>
<td>
</td>
<td>
</td>

<td>
</td>
<td>
</td>
</tr>

</xsl:template>






<xsl:template match="DatiRitenuta">

<table class="tbFoglio">

<thead>
<tr>
<th class="title"> Dati ritenuta d'acconto</th>
<th class="perc">Aliquota ritenuta</th>
<th>Causale </th>
<th width="15%">Importo </th>
</tr>
</thead>
<tbody>
<tr>
<td >

<xsl:if test="TipoRitenuta">

<span>
<xsl:value-of select="TipoRitenuta" />
</span>
<xsl:variable name="TR">
<xsl:value-of select="TipoRitenuta" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$TR='RT01'">
(ritenuta persone fisiche)
</xsl:when>
<xsl:when test="$TR='RT02'">
(ritenuta persone giuridiche)
</xsl:when>
<xsl:when test="$TR=''">
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>

</xsl:if>
</td>

<td class="import" >
<xsl:if test="AliquotaRitenuta">
<xsl:value-of select="format-number(AliquotaRitenuta, '###.###.##0,00', 'euro')" />
</xsl:if>

</td>

<td >
<xsl:if test="CausalePagamento">

<span>
<xsl:value-of select="CausalePagamento" />
</span>
<xsl:variable name="CP">
<xsl:value-of select="CausalePagamento" />
</xsl:variable>
<xsl:if test="$CP!=''">
(decodifica come da modello 770S)
</xsl:if>

</xsl:if>
</td>

<td class="import" >
<xsl:if test="ImportoRitenuta">

<xsl:value-of select="format-number(ImportoRitenuta, '###.###.##0,00', 'euro')" />

</xsl:if>
</td>

</tr>
</tbody>
</table>
</xsl:template>


<xsl:template name="FatturaElettronica">

<xsl:param name="TipoFattura" />
<xsl:param name="IsFPRS" />

<xsl:if test="$TipoFattura">


<!--Variabile che contiene il codice destinatario dall'HEADER perchè viene visualizzato nella sezione BODY -->
<!--<xsl:variable name="CodiceDestinatario" select="$TipoFattura/FatturaElettronicaHeader/DatiTrasmissione/CodiceDestinatario"/>-->
<xsl:variable name="PecDestinatario" select="$TipoFattura/FatturaElettronicaHeader/DatiTrasmissione/PECDestinatario"/>

<!--Variabile che contiene il codice destinatario dall'HEADER perchè viene visualizzato nella sezione BODY -->
<xsl:variable name="CodiceDestinatario" >

<xsl:choose>
<xsl:when test="$TipoFattura/FatturaElettronicaHeader/DatiTrasmissione/CodiceDestinatario='0000000'">
<xsl:value-of select="$TipoFattura/FatturaElettronicaHeader/DatiTrasmissione/PECDestinatario" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$TipoFattura/FatturaElettronicaHeader/DatiTrasmissione/CodiceDestinatario" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<div id="fattura-elettronica" class="page">

<!-- FatturaElettronicaHeader -->
<xsl:if test="$TipoFattura/FatturaElettronicaHeader">



<table id="tbHeader" class="tbHeader">

<tr >
<td class="tdHead">

<table class="tableHead">
<tr>

<td >

<!--INIZIO CEDENTE PRESTATORE-->
<div class="headBorder" >

<label class= "headerLabel">Cedente/prestatore (fornitore) </label>
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore">

<xsl:choose>
<xsl:when test="DatiAnagrafici">
<!--DatiAnagrafici FPA\FPR-->

<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/DatiAnagrafici">

<div class="headContent mt5">
<xsl:if test="IdFiscaleIVA">

Identificativo fiscale ai fini IVA:
<span>
<xsl:value-of select="IdFiscaleIVA/IdPaese" />
<xsl:value-of select="IdFiscaleIVA/IdCodice" />
</span>

</xsl:if>
</div>

<div class="headContent" >

<xsl:if test="CodiceFiscale">

Codice fiscale:
<span>
<xsl:value-of select="CodiceFiscale" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Anagrafica/Denominazione">

Denominazione:
<span>
<xsl:value-of select="Anagrafica/Denominazione" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Anagrafica/Nome | Anagrafica/Cognome">

Cognome nome:

<xsl:if test="Anagrafica/Cognome">
<span>
<xsl:value-of select="Anagrafica/Cognome" />
<xsl:text> </xsl:text>
</span>
</xsl:if>
<xsl:if test="Anagrafica/Nome">
<span>
<xsl:value-of select="Anagrafica/Nome" />
</span>
</xsl:if>

</xsl:if>

</div>


<div class="headContent" >

<xsl:if test="RegimeFiscale">

Regime fiscale:
<span>
<xsl:value-of select="RegimeFiscale" />
</span>

<xsl:variable name="RF">
<xsl:value-of select="RegimeFiscale" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$RF='RF01'">
(ordinario)
</xsl:when>
<xsl:when test="$RF='RF02'">
(contribuenti minimi)
</xsl:when>
<xsl:when test="$RF='RF03'">
(nuove iniziative produttive)
</xsl:when>
<xsl:when test="$RF='RF04'">
(agricoltura e attività connesse e pesca)
</xsl:when>
<xsl:when test="$RF='RF05'">
(vendita sali e tabacchi)
</xsl:when>
<xsl:when test="$RF='RF06'">
(commercio fiammiferi)
</xsl:when>
<xsl:when test="$RF='RF07'">
(editoria)
</xsl:when>
<xsl:when test="$RF='RF08'">
(gestione servizi telefonia pubblica)
</xsl:when>
<xsl:when test="$RF='RF09'">
(rivendita documenti di trasporto pubblico e di sosta)
</xsl:when>
<xsl:when test="$RF='RF10'">
(intrattenimenti, giochi e altre attività di cui alla tariffa allegata al DPR 640/72)
</xsl:when>
<xsl:when test="$RF='RF11'">
(agenzie viaggi e turismo)
</xsl:when>
<xsl:when test="$RF='RF12'">
(agriturismo)
</xsl:when>
<xsl:when test="$RF='RF13'">
(vendite a domicilio)
</xsl:when>
<xsl:when test="$RF='RF14'">
(rivendita beni usati, oggetti d’arte,
d’antiquariato o da collezione)
</xsl:when>
<xsl:when test="$RF='RF15'">
(agenzie di vendite all’asta di oggetti d’arte,
antiquariato o da collezione)
</xsl:when>
<xsl:when test="$RF='RF16'">
(IVA per cassa P.A.)
</xsl:when>
<xsl:when test="$RF='RF17'">
(IVA per cassa - art. 32-bis, D.L. 83/2012)
</xsl:when>
<xsl:when test="$RF='RF19'">
(Regime forfettario)
</xsl:when>
<xsl:when test="$RF='RF18'">
(altro)
</xsl:when>
<xsl:when test="$RF=''">
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>

</xsl:if>

</div>

</xsl:for-each>

<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Sede">

<div class="headContent" >

<xsl:if test="Indirizzo">

Indirizzo:
<span>
<xsl:value-of select="Indirizzo" />
<xsl:text> </xsl:text>
<xsl:value-of select="NumeroCivico" />
</span>

</xsl:if>

</div>

<div class="headContent" >
<span>
<xsl:if test="Comune">

Comune:
<span>
<xsl:value-of select="Comune" />

</span>

</xsl:if>
<xsl:if test="Provincia">

Provincia:
<span>
<xsl:value-of select="Provincia" />

</span>

</xsl:if>
</span>


</div>
<div class="headContent" >

<span>
<xsl:if test="CAP">
Cap:
<span>
<xsl:value-of select="CAP" />

</span>
</xsl:if>

<xsl:if test="Nazione">

Nazione:
<span>
<xsl:value-of select="Nazione" />

</span>

</xsl:if>
</span>

</div>
</xsl:for-each>
<div class="headContent" >

<xsl:if test="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Contatti/Telefono">

Telefono:
<span>
<xsl:value-of select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Contatti/Telefono" />

</span>

</xsl:if>


</div>

<div class="headContent" >

<xsl:if test="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Contatti/Email">

Email:
<span>
<xsl:value-of select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Contatti/Email" />

</span>

</xsl:if>



</div>

<div class="headContent" >

<xsl:if test="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/RiferimentoAmministrazione">

Riferimento Amministrazione:
<span>
<xsl:value-of select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/RiferimentoAmministrazione" />

</span>

</xsl:if>



</div>

</xsl:when>
<xsl:otherwise>
<!--Anagrafica FPRS-->
<div class="headContent mt5">
<xsl:if test="IdFiscaleIVA">

Identificativo fiscale ai fini IVA:
<span>
<xsl:value-of select="IdFiscaleIVA/IdPaese" />
<xsl:value-of select="IdFiscaleIVA/IdCodice" />
</span>

</xsl:if>
</div>

<div class="headContent" >

<xsl:if test="CodiceFiscale">

Codice fiscale:
<span>
<xsl:value-of select="CodiceFiscale" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Nome | Cognome">

Cognome nome:

<xsl:if test="Cognome">
<span>
<xsl:value-of select="Cognome" />
<xsl:text> </xsl:text>
</span>
</xsl:if>
<xsl:if test="Nome">
<span>
<xsl:value-of select="Nome" />
</span>
</xsl:if>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="RegimeFiscale">

Regime fiscale:
<span>
<xsl:value-of select="RegimeFiscale" />
</span>

<xsl:variable name="RF">
<xsl:value-of select="RegimeFiscale" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$RF='RF01'">
(ordinario)
</xsl:when>
<xsl:when test="$RF='RF02'">
(contribuenti minimi)
</xsl:when>
<xsl:when test="$RF='RF03'">
(nuove iniziative produttive)
</xsl:when>
<xsl:when test="$RF='RF04'">
(agricoltura e attività connesse e pesca)
</xsl:when>
<xsl:when test="$RF='RF05'">
(vendita sali e tabacchi)
</xsl:when>
<xsl:when test="$RF='RF06'">
(commercio fiammiferi)
</xsl:when>
<xsl:when test="$RF='RF07'">
(editoria)
</xsl:when>
<xsl:when test="$RF='RF08'">
(gestione servizi telefonia pubblica)
</xsl:when>
<xsl:when test="$RF='RF09'">
(rivendita documenti di trasporto pubblico e di sosta)
</xsl:when>
<xsl:when test="$RF='RF10'">
(intrattenimenti, giochi e altre attività di cui alla tariffa allegata al DPR 640/72)
</xsl:when>
<xsl:when test="$RF='RF11'">
(agenzie viaggi e turismo)
</xsl:when>
<xsl:when test="$RF='RF12'">
(agriturismo)
</xsl:when>
<xsl:when test="$RF='RF13'">
(vendite a domicilio)
</xsl:when>
<xsl:when test="$RF='RF14'">
(rivendita beni usati, oggetti d’arte,
d’antiquariato o da collezione)
</xsl:when>
<xsl:when test="$RF='RF15'">
(agenzie di vendite all’asta di oggetti d’arte,
antiquariato o da collezione)
</xsl:when>
<xsl:when test="$RF='RF16'">
(IVA per cassa P.A.)
</xsl:when>
<xsl:when test="$RF='RF17'">
(IVA per cassa - art. 32-bis, D.L. 83/2012)
</xsl:when>
<xsl:when test="$RF='RF19'">
(Regime forfettario)
</xsl:when>
<xsl:when test="$RF='RF18'">
(altro)
</xsl:when>
<xsl:when test="$RF=''">
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>

</xsl:if>

</div>

<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CedentePrestatore/Sede">

<div class="headContent" >

<xsl:if test="Indirizzo">

Indirizzo:
<span>
<xsl:value-of select="Indirizzo" />
<xsl:text> </xsl:text>
<xsl:value-of select="NumeroCivico" />
</span>

</xsl:if>

</div>

<div class="headContent" >
<span>
<xsl:if test="Comune">

Comune:
<span>
<xsl:value-of select="Comune" />

</span>

</xsl:if>
<xsl:if test="Provincia">

Provincia:
<span>
<xsl:value-of select="Provincia" />

</span>

</xsl:if>
</span>


</div>
<div class="headContent" >

<span>
<xsl:if test="CAP">
Cap:
<span>
<xsl:value-of select="CAP" />

</span>
</xsl:if>

<xsl:if test="Nazione">

Nazione:
<span>
<xsl:value-of select="Nazione" />

</span>

</xsl:if>
</span>

</div>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>

</xsl:for-each>
</div>

<!--FINE CEDENTE PRESTATORE-->

</td>
</tr>

</table>



</td>
<td class="tdHead">

<table class="tableHead">
<tr>
<td >
<!--INIZIO CESSIONARIO COMMITTENTE-->

<div class="headBorder" >
<label class= "headerLabel" >Cessionario/committente (cliente) </label>
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente">
<xsl:choose>
<xsl:when test="DatiAnagrafici">
<!--DatiAnagrafici FPA\FPR-->
<xsl:for-each select="DatiAnagrafici">

<div class="headContent mt5" >
<xsl:if test="IdFiscaleIVA">

Identificativo fiscale ai fini IVA:
<span>
<xsl:value-of select="IdFiscaleIVA/IdPaese" />
<xsl:value-of select="IdFiscaleIVA/IdCodice" />
</span>

</xsl:if>
</div>

<div class="headContent" >

<xsl:if test="CodiceFiscale">

Codice fiscale:
<span>
<xsl:value-of select="CodiceFiscale" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Anagrafica/Denominazione">

Denominazione:
<span>
<xsl:value-of select="Anagrafica/Denominazione" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Anagrafica/Nome | Anagrafica/Cognome">

Cognome nome:

<xsl:if test="Anagrafica/Cognome">
<span>
<xsl:value-of select="Anagrafica/Cognome" />
<xsl:text> </xsl:text>
</span>
</xsl:if>
<xsl:if test="Anagrafica/Nome">
<span>
<xsl:value-of select="Anagrafica/Nome" />
</span>
</xsl:if>

</xsl:if>

</div>


</xsl:for-each>

<xsl:for-each select="Sede">

<div class="headContent" >

<xsl:if test="Indirizzo">

Indirizzo:
<span>
<xsl:value-of select="Indirizzo" />
<xsl:text> </xsl:text>
<xsl:value-of select="NumeroCivico" />
</span>

</xsl:if>

</div>



<div class="headContent" >
<span>
<xsl:if test="Comune">

Comune:
<span>
<xsl:value-of select="Comune" />

</span>

</xsl:if>
<xsl:if test="Provincia">

Provincia:
<span>
<xsl:value-of select="Provincia" />

</span>

</xsl:if>
</span>


</div>
<div class="headContent" >

<span>
<xsl:if test="CAP">
Cap:
<span>
<xsl:value-of select="CAP" />

</span>
</xsl:if>

<xsl:if test="Nazione">

Nazione:
<span>
<xsl:value-of select="Nazione" />

</span>

</xsl:if>
</span>

</div>
<div class="headContent" >

<xsl:if test="$PecDestinatario">

Pec: <span>
<xsl:value-of select="$PecDestinatario" />
</span>

</xsl:if>

</div>


</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!--Anagrafica FPRS-->
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente/IdentificativiFiscali">
<div class="headContent mt5" >
<xsl:if test="IdFiscaleIVA">

Identificativo fiscale ai fini IVA:
<span>
<xsl:value-of select="IdFiscaleIVA/IdPaese" />
<xsl:value-of select="IdFiscaleIVA/IdCodice" />
</span>

</xsl:if>
</div>

<div class="headContent" >

<xsl:if test="CodiceFiscale">

Codice fiscale:
<span>
<xsl:value-of select="CodiceFiscale" />
</span>

</xsl:if>

</div>
</xsl:for-each>
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente/AltriDatiIdentificativi">
<div class="headContent" >

<xsl:if test="Denominazione">

Denominazione:
<span>
<xsl:value-of select="Denominazione" />
</span>

</xsl:if>

</div>

<div class="headContent" >

<xsl:if test="Nome | Cognome">

Cognome nome:

<xsl:if test="Cognome">
<span>
<xsl:value-of select="Cognome" />
<xsl:text> </xsl:text>
</span>
</xsl:if>
<xsl:if test="Nome">
<span>
<xsl:value-of select="Nome" />
</span>
</xsl:if>

</xsl:if>

</div>

<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente/AltriDatiIdentificativi/Sede">

<div class="headContent" >

<xsl:if test="Indirizzo">

Indirizzo:
<span>
<xsl:value-of select="Indirizzo" />
<xsl:text> </xsl:text>
<xsl:value-of select="NumeroCivico" />
</span>

</xsl:if>

</div>



<div class="headContent" >
<span>
<xsl:if test="Comune">

Comune:
<span>
<xsl:value-of select="Comune" />

</span>

</xsl:if>
<xsl:if test="Provincia">

Provincia:
<span>
<xsl:value-of select="Provincia" />

</span>

</xsl:if>
</span>


</div>
<div class="headContent" >

<span>
<xsl:if test="CAP">
Cap:
<span>
<xsl:value-of select="CAP" />

</span>
</xsl:if>

<xsl:if test="Nazione">

Nazione:
<span>
<xsl:value-of select="Nazione" />

</span>

</xsl:if>
</span>

</div>
<div class="headContent" >

<xsl:if test="$PecDestinatario">

Pec: <span>
<xsl:value-of select="$PecDestinatario" />
</span>

</xsl:if>

</div>


</xsl:for-each>

</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

</div>



<!--FINE CESSIONARIO COMMITTENTE-->

</td>
</tr>

</table>




</td>
</tr>



</table>


</xsl:if>
<div style="height:10px" > </div>

<!-- FINE FatturaElettronicaHeader -->

<!--INIZIO BODY-->

<xsl:for-each select="$TipoFattura/FatturaElettronicaBody" >

<!-- Conforme Standard AssoSoftware se altridatigestionali presenta ASWRELSTD -->
<xsl:variable name="posASWRELSTD" >
<xsl:for-each select="DatiBeniServizi/DettaglioLinee">
<xsl:variable name="DettaglioLinee" select="."/>
<xsl:variable name="posDettaglioLinee" select="position()"/>
<xsl:for-each select="AltriDatiGestionali">

<xsl:if test=" translate( TipoDato,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'
) = 'aswrelstd'">

<xsl:value-of select="number($posDettaglioLinee)"/>

</xsl:if>
</xsl:for-each>

</xsl:for-each>
</xsl:variable>
<!-- FINE conforme AssoSoftware -->


<table class="tbFoglio">

<!-- TIPOLOGIA DOCUMENTO TESTATA-->
<thead>
<tr>

<th>Tipologia documento</th>
<th class="perc">Art. 73</th>
<th >Numero documento</th>
<th class="data">Data documento</th>
<th >Codice destinatario</th>

</tr>
</thead>
<tbody>
<tr>
<td>
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/TipoDocumento">

<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/TipoDocumento" />


<xsl:variable name="TD">
<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/TipoDocumento" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$TD='TD01'">
(fattura)
</xsl:when>
<xsl:when test="$TD='TD02'">
(acconto/anticipo su fattura)
</xsl:when>
<xsl:when test="$TD='TD03'">
(acconto/anticipo su parcella)
</xsl:when>
<xsl:when test="$TD='TD04'">
(nota di credito)
</xsl:when>
<xsl:when test="$TD='TD05'">
(nota di debito)
</xsl:when>
<xsl:when test="$TD='TD06'">
(parcella)
</xsl:when>
<xsl:when test="$TD='TD20'">
(autofattura)
</xsl:when>
<!--FPRS-->
<xsl:when test="$TD='TD07'">
(fattura semplificata)
</xsl:when>
<xsl:when test="$TD='TD08'">
(nota di credito semplificata)
</xsl:when>
<xsl:when test="$TD='TD09'">
(nota di debito semplificata)
</xsl:when>
<xsl:when test="$TD=''">
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>

</xsl:if>
</td>

<td class="ritenuta" >
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Art73">
<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/Art73" />
</xsl:if>
</td>

<td class="textCenter" >

<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Numero">
<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/Numero" />
</xsl:if>
</td>
<td class="data" >

<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Data">
<xsl:call-template name="FormatDateIta">
<xsl:with-param name="DateTime" select="DatiGenerali/DatiGeneraliDocumento/Data" />
</xsl:call-template>
</xsl:if>

</td>

<td class="textCenter" >
<xsl:choose>
<xsl:when test="$PecDestinatario">
Indicata PEC
</xsl:when>

<xsl:otherwise>
<xsl:if test="$CodiceDestinatario">
<xsl:value-of select="$CodiceDestinatario" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</td>

</tr>

<!--FINE TIPOLOGIA Documento TESTATA-->
</tbody>
</table>

<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Causale">
<div class="separa"> </div>
<table class="tbFoglio">

<!-- TIPOLOGIA DOCUMENTO TESTATA - parte causale-->
<thead>
<tr>
<th>Causale</th>
</tr>
</thead>
<tbody>
<tr>

<td >
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Causale">

<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/Causale" >
<xsl:value-of select="." />
</xsl:for-each>

</xsl:if>
</td>

</tr>

<!--FINE TIPOLOGIA Documento TESTATA - parte causale -->
</tbody>
</table>
</xsl:if>

<div class="separa"> </div>

<xsl:choose>
<xsl:when test="$IsFPRS='1'">

<!-- Dettaglio Linee -->
<table class="tbFoglio" >

<thead>
<tr>
<th>Descrizione</th>
<th class="perc">Imposta</th>
<th class="perc2">%IVA</th>
<th class="ximport">Prezzo totale</th>

</tr>
</thead>
<tbody>

<xsl:for-each select="DatiBeniServizi" >

<tr>
<td>

<xsl:if test="Descrizione">
<xsl:value-of select="Descrizione" />
</xsl:if>

<xsl:if test="RiferimentoNormativo">
<div class="tx-xsmall">
RIF.NORM. <xsl:value-of select="RiferimentoNormativo" />
</div>
</xsl:if>

</td>
<td class="import" >

<xsl:if test="DatiIVA/Imposta">
<xsl:value-of select="format-number(DatiIVA/Imposta, '###.###.##0,00', 'euro')" />
</xsl:if>
</td>
<td class="import" >

<xsl:call-template name="FormatIVA">
<xsl:with-param name="Natura" select="Natura" />
<xsl:with-param name="IVA" select="DatiIVA/Aliquota" />
</xsl:call-template>

</td>
<td class="import" >
<xsl:if test="Importo">
<xsl:value-of select="format-number(Importo, '###.###.##0,00', 'euro')" />
</xsl:if>
</td>
</tr>

</xsl:for-each>


</tbody>

</table>

</xsl:when>
<xsl:otherwise>

<!-- Dettaglio Linee -->
<table class="tbFoglio" >

<thead>
<tr>
<th width="80px">Cod. articolo</th>
<th>Descrizione</th>
<th class="import2" >Quantità</th>
<th class="import2">Prezzo unitario</th>
<th class="perc2">UM</th>
<th class="perc">Sconto o magg.</th>
<th class="perc2">%IVA</th>
<th class="ximport">Prezzo totale</th>

</tr>
</thead>
<tbody>

<xsl:for-each select="DatiBeniServizi/DettaglioLinee" >
<xsl:apply-templates select=".">
<xsl:with-param name="r" select="position()"/>
<xsl:with-param name="posASWRELSTD" select="$posASWRELSTD"/>
</xsl:apply-templates>
</xsl:for-each>


</tbody>

</table>

<!-- Dati Cassa Prevvidenziale -->
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiCassaPrevidenziale">
<div class="separa"> </div>

<table class="tbFoglio">

<thead>
<tr>
<th class="title">Dati Cassa Previdenziale</th>
<th>Imponibile</th>
<th class="perc">%Contr.</th>
<th class="perc">Ritenuta</th>
<th class="perc">%IVA</th>
<th >Importo</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/DatiCassaPrevidenziale" >

<tr>
<td>
<xsl:if test="TipoCassa">

<span>
<xsl:value-of select="TipoCassa" />
</span>
<xsl:variable name="TC">
<xsl:value-of select="TipoCassa" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$TC='TC01'">
(Cassa Nazionale Previdenza e Assistenza Avvocati
e Procuratori legali)
</xsl:when>
<xsl:when test="$TC='TC02'">
(Cassa Previdenza Dottori Commercialisti)
</xsl:when>
<xsl:when test="$TC='TC03'">
(Cassa Previdenza e Assistenza Geometri)
</xsl:when>
<xsl:when test="$TC='TC04'">
(Cassa Nazionale Previdenza e Assistenza
Ingegneri e Architetti liberi profess.)
</xsl:when>
<xsl:when test="$TC='TC05'">
(Cassa Nazionale del Notariato)
</xsl:when>
<xsl:when test="$TC='TC06'">
(Cassa Nazionale Previdenza e Assistenza
Ragionieri e Periti commerciali)
</xsl:when>
<xsl:when test="$TC='TC07'">
(Ente Nazionale Assistenza Agenti e Rappresentanti
di Commercio-ENASARCO)
</xsl:when>
<xsl:when test="$TC='TC08'">
(Ente Nazionale Previdenza e Assistenza Consulenti
del Lavoro-ENPACL)
</xsl:when>
<xsl:when test="$TC='TC09'">
(Ente Nazionale Previdenza e Assistenza
Medici-ENPAM)
</xsl:when>
<xsl:when test="$TC='TC10'">
(Ente Nazionale Previdenza e Assistenza
Farmacisti-ENPAF)
</xsl:when>
<xsl:when test="$TC='TC11'">
(Ente Nazionale Previdenza e Assistenza
Veterinari-ENPAV)
</xsl:when>
<xsl:when test="$TC='TC12'">
(Ente Nazionale Previdenza e Assistenza Impiegati
dell'Agricoltura-ENPAIA)
</xsl:when>
<xsl:when test="$TC='TC13'">
(Fondo Previdenza Impiegati Imprese di Spedizione
e Agenzie Marittime)
</xsl:when>
<xsl:when test="$TC='TC14'">
(Istituto Nazionale Previdenza Giornalisti
Italiani-INPGI)
</xsl:when>
<xsl:when test="$TC='TC15'">
(Opera Nazionale Assistenza Orfani Sanitari
Italiani-ONAOSI)
</xsl:when>
<xsl:when test="$TC='TC16'">
(Cassa Autonoma Assistenza Integrativa
Giornalisti Italiani-CASAGIT)
</xsl:when>
<xsl:when test="$TC='TC17'">
(Ente Previdenza Periti Industriali e Periti
Industriali Laureati-EPPI)
</xsl:when>
<xsl:when test="$TC='TC18'">
(Ente Previdenza e Assistenza
Pluricategoriale-EPAP)
</xsl:when>
<xsl:when test="$TC='TC19'">
(Ente Nazionale Previdenza e Assistenza
Biologi-ENPAB)
</xsl:when>
<xsl:when test="$TC='TC20'">
(Ente Nazionale Previdenza e Assistenza
Professione Infermieristica-ENPAPI)
</xsl:when>
<xsl:when test="$TC='TC21'">
(Ente Nazionale Previdenza e Assistenza
Psicologi-ENPAP)
</xsl:when>
<xsl:when test="$TC='TC22'">
(INPS)
</xsl:when>
<xsl:when test="$TC=''">
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>

</xsl:if>
</td>
<td class="import">
<xsl:if test="ImponibileCassa">
<xsl:value-of select="format-number(ImponibileCassa, '###.###.##0,00', 'euro')" />
</xsl:if>
</td>

<td class="import">
<xsl:if test="AlCassa">

<xsl:value-of select="format-number(AlCassa, '###.###.##0,00', 'euro')" />

</xsl:if>

</td>

<td class="Ritenuta" >
<xsl:if test="Ritenuta">

<xsl:value-of select="Ritenuta" />

</xsl:if>
</td>

<td class="import" >

<xsl:choose>
<xsl:when test="Natura">

<xsl:value-of select="Natura" />

</xsl:when>
<xsl:otherwise>
<xsl:if test="AliquotaIVA">

<xsl:value-of select="format-number(AliquotaIVA, '###.###.##0,00', 'euro')" />

</xsl:if>
</xsl:otherwise>
</xsl:choose>

</td>

<td class="import">
<xsl:if test="ImportoContributoCassa">

<xsl:value-of select="format-number(ImportoContributoCassa, '###.###.##0,00', 'euro')" />

</xsl:if>

</td>

</tr>

</xsl:for-each>


</tbody>
</table>


</xsl:if>
<!-- Fine Cassa Prevvidenziale -->


<div class="separa" > </div>
<!-- Dati RIEPILOGO-->

<table class="tbTitolo">
<thead>
<tr>
<th>RIEPILOGHI IVA E TOTALI</th>
</tr>
</thead>
</table>



<table class="tbFoglio">
<thead>
<tr >

<th colspan="3" >esigibilità iva / riferimenti normativi</th>
<th class="perc">%IVA</th>
<th>Spese accessorie</th>
<th colspan="3" >Totale imponibile</th>
<th colspan="2" >Totale imposta</th>
</tr>
</thead>
<tbody>

<xsl:for-each select="DatiBeniServizi/DatiRiepilogo" >

<xsl:if test="number(ImponibileImporto)">

<tr>
<td colspan="3" >
<xsl:choose>
<xsl:when test="EsigibilitaIVA">

<span>
<xsl:value-of select="EsigibilitaIVA" />
</span>
<xsl:variable name="EI">
<xsl:value-of select="EsigibilitaIVA" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$EI='I'">
(esigibilità immediata)
</xsl:when>
<xsl:when test="$EI='D'">
(esigibilità differita)
</xsl:when>
<xsl:when test="$EI='S'">
(scissione dei pagamenti)
</xsl:when>
<xsl:otherwise>
<span>(!!! codice non previsto !!!)</span>
</xsl:otherwise>
</xsl:choose>
</xsl:when>

<xsl:otherwise>

<span>Esigib. non dich. (si presume immediata)</span>

</xsl:otherwise>
</xsl:choose>

<xsl:if test="RiferimentoNormativo">
<div class="tx-xsmall">
<xsl:value-of select="RiferimentoNormativo" />
</div>
</xsl:if>
</td>


<td class="import" >

<xsl:call-template name="FormatIVA">
<xsl:with-param name="Natura" select="Natura" />
<xsl:with-param name="IVA" select="AliquotaIVA" />
</xsl:call-template>


</td>


<td class="import">

<xsl:if test="SpeseAccessorie">
<xsl:value-of select="format-number(SpeseAccessorie, '###.###.##0,00', 'euro')" />
</xsl:if>
</td>


<td colspan="3" class="import" >

<xsl:if test="ImponibileImporto">
<xsl:value-of select="format-number(ImponibileImporto, '###.###.##0,00', 'euro')" />
</xsl:if>
</td>

<td colspan="2" class="import" >

<xsl:if test="Imposta">

<xsl:choose>
<xsl:when test="Imposta = 0">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="format-number(Imposta, '###.###.##0,00', 'euro')" />
</xsl:otherwise>
</xsl:choose>



</xsl:if>
</td>

</tr>

</xsl:if>

</xsl:for-each>

<!-- Importo Totale -->
<tr >

<th colspan="2">
Importo bollo
</th>
<th colspan="3">
Sconto/Maggiorazione
</th>

<th colspan="2" >
Valuta
</th>

<th colspan="3" >
Totale documento
</th>


</tr>

<tr >
<td colspan="2" class="import" >
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiBollo/ImportoBollo">

<xsl:value-of select="format-number(DatiGenerali/DatiGeneraliDocumento/DatiBollo/ImportoBollo, '###.###.##0,00', 'euro')" />

</xsl:if>
</td>
<td colspan="3" class="import">
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/ScontoMaggiorazione" >

<xsl:call-template name="FormatSconto" >
<xsl:with-param name="tipo" select="Tipo" />
<xsl:with-param name="percentuale" select="Percentuale" />
<xsl:with-param name="importo" select="Importo" />
</xsl:call-template>


</xsl:for-each>
</td>


<td colspan="2" class="textCenter" >

<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Divisa">

<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/Divisa" />

</xsl:if>
</td>

<td colspan="3" class="import">

<xsl:if test="DatiGenerali/DatiGeneraliDocumento/ImportoTotaleDocumento">

<xsl:value-of select="format-number(DatiGenerali/DatiGeneraliDocumento/ImportoTotaleDocumento, '###.###.##0,00', 'euro')" />

</xsl:if>
</td>

</tr>

<!-- FINE Importo Totale -->
</tbody>
</table>
<!-- FINE Dettaglio Linee -->


<!-- Dati Ritenuta Acconto -->
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta">
<div class="separa"> </div>
<xsl:apply-templates select="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta"/>
</xsl:if>
<!-- Fine Dati Ritenuta -->


<div class="separa"> </div>


<!-- Dati Pagamento -->

<table class="tbFoglio" >
<thead>
<tr>
<th>Modalità pagamento</th>
<th>IBAN</th>
<th>Istituto</th>
<th class="data">Data scadenza</th>
<th class="ximport">Importo</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="DatiPagamento" >

<xsl:for-each select="DettaglioPagamento">

<tr>
<td>

<xsl:if test="ModalitaPagamento">
<span>
<xsl:value-of select="ModalitaPagamento" />
</span>
<xsl:variable name="MP">
<xsl:value-of select="ModalitaPagamento" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$MP='MP01'">
Contanti
</xsl:when>
<xsl:when test="$MP='MP02'">
Assegno
</xsl:when>
<xsl:when test="$MP='MP03'">
Assegno circolare
</xsl:when>
<xsl:when test="$MP='MP04'">
Contanti presso Tesoreria
</xsl:when>
<xsl:when test="$MP='MP05'">
Bonifico
</xsl:when>
<xsl:when test="$MP='MP06'">
Vaglia cambiario
</xsl:when>
<xsl:when test="$MP='MP07'">
Bollettino bancario
</xsl:when>
<xsl:when test="$MP='MP08'">
Carta di pagamento
</xsl:when>
<xsl:when test="$MP='MP09'">
RID
</xsl:when>
<xsl:when test="$MP='MP10'">
RID utenze
</xsl:when>
<xsl:when test="$MP='MP11'">
RID veloce
</xsl:when>
<xsl:when test="$MP='MP12'">
RIBA
</xsl:when>
<xsl:when test="$MP='MP13'">
MAV
</xsl:when>
<xsl:when test="$MP='MP14'">
Quietanza erario
</xsl:when>
<xsl:when test="$MP='MP15'">
Giroconto su conti di contabilità speciale
</xsl:when>
<xsl:when test="$MP='MP16'">
Domiciliazione bancaria
</xsl:when>
<xsl:when test="$MP='MP17'">
Domiciliazione postale
</xsl:when>
<xsl:when test="$MP='MP18'">
Bollettino di c/c postale
</xsl:when>
<xsl:when test="$MP='MP19'">
SEPA Direct Debit
</xsl:when>
<xsl:when test="$MP='MP20'">
SEPA Direct Debit CORE
</xsl:when>
<xsl:when test="$MP='MP21'">
SEPA Direct Debit B2B
</xsl:when>
<xsl:when test="$MP='MP22'">
Trattenuta su somme già riscosse
</xsl:when>
<xsl:when test="$MP=''">
</xsl:when>
<xsl:otherwise>
<span></span>
</xsl:otherwise>
</xsl:choose>
<span>
<xsl:value-of select="OpzDescrizionePagamento" />
</span>
</xsl:if>

</td>


<td>

<xsl:if test="IBAN">

<xsl:value-of select="IBAN" />

</xsl:if>
</td>

<td>

<xsl:if test="IstitutoFinanziario">
<xsl:value-of select="IstitutoFinanziario" />
</xsl:if>
</td>

<td class="data">
<xsl:if test="DataScadenzaPagamento">
<xsl:call-template name="FormatDateIta">
<xsl:with-param name="DateTime" select="DataScadenzaPagamento" />
</xsl:call-template>
</xsl:if>
</td>

<td class="import">

<xsl:if test="ImportoPagamento">

<xsl:value-of select="format-number(ImportoPagamento, '###.###.##0,00', 'euro')" />

</xsl:if>
</td>
</tr>
</xsl:for-each>

</xsl:for-each>
</tbody>
</table>
<!-- FINE Dati Pagamento -->

<div style="height:10px" > </div>

<xsl:for-each select="OpzRiepilogoIVA" >
<div class="tx-xsmall">
* <xsl:value-of select="." />
</div>

</xsl:for-each>
<xsl:if test="OpzRiepilogoIVA">
<div style="height:10px" > </div>
</xsl:if>

</xsl:otherwise>

</xsl:choose>

<!-- Definizione degli allegati -->
<xsl:if test="Allegati">

<div class="tx-small" >Allegati:</div>

<ul class="ulAllegati">
<xsl:for-each select="Allegati">
<li>
<div class="tx-small">

<xsl:value-of select="NomeAttachment" />
<xsl:text> </xsl:text>
<xsl:value-of select="DescrizioneAttachment" />
</div>
</li>


</xsl:for-each>

</ul>

</xsl:if>

<!--Definizione se fattura è AssoSofware-->

<xsl:if test="$posASWRELSTD &gt; 0 ">
<div class="dtASWRELSTD">

<label class="headerLabel">Conforme Standard AssoSoftware</label>

</div>

</xsl:if>


<!-- FINE ASWRELSTD -->


</xsl:for-each>
<!--FINE BODY-->

</div>



</xsl:if>
</xsl:template>

<xsl:template match="/">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">

#fattura-elettronica
{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin-left: auto;
margin-right: auto;
max-width: 1280px;
min-width: 800px;
padding: 0; }

#fattura-elettronica
div.page {
}

.tbHeader
{
width: 800px;
border: 2px solid black;
}


tr td {vertical-align: top;}

.tdHead {
width: 50%;
height: 91px;
border: 1px solid black;
}

.tableHead
{
font-size:smaller;
width: 100%;
}

.headBorder
{
<!--border: 2px solid black;
width:100%;
height: 210px;
border-bottom-left-radius:30px;
border-bottom-right-radius:30px; -->
}

.headerLabel
{
color:#282828;
font-weight:bold;


}

.headContent
{
margin-left:10px;
margin-bottom:0px
}

.mt5
{
margin-top:5px
}


tr.break { page-break-after: always; }

.ulAllegati
{
margin-top:0px;
}


.separa
{
height:20px;
}

table.tbTitolo
{
width: 800px;
table-layout: fixed;
border-collapse: collapse;
word-wrap:normal; <!--break-word;-->
}
table.tbTitolo th {
padding-left: 5px;
padding-right: 5px;
border: solid 1px #000000;
border-bottom: none;
background-color: LightCyan;
font-size:x-small;

}


table.tbFoglio
{
width: 800px;
table-layout: fixed;
border-collapse: collapse;
word-wrap:normal; <!--break-word;-->
}
table.tbFoglio th {
padding-left: 5px;
padding-right: 5px;
border: solid 1px #000000;
background-color: LightGrey;

<!-- text-transform: uppercase; -->
font-size:x-small;


}

table.tbFoglio tbody
{
border: solid 1px #000000;
}

table.tbFoglio th .perc
{
width:50px;
}

table.tbFoglio td {
font-size:small;

border-right: solid 1px #000000;
border-bottom: none;
border-left: solid 1px #000000;
}

table.tbFoglio tr {


}

.textRight
{
text-align:right;
}

.textCenter
{
text-align:center;
}

.textPerc
{
width:50px;
}

td.Ritenuta
{
width:50px;
text-align:center;
}

th.title, .title td {
width:48%
}

th.perc {
width:50px;
}

th.perc2 {
width:40px;
}

th.data {
width:100px;
}

th.import
{
width:100px;
}

td.import
{
text-align:right;
}

th.import2
{
width:80px;
}

td.import2
{
text-align:right;
}

th.ximport
{
width:100px;
}

td.ximport
{
text-align:center;
}

th.ximport2
{
width:80px;
}

td.ximport2
{
text-align:center;
}

td.data
{
text-align:center;
}

.tx-xsmall {
font-size:x-small;
}

.tx-small {
font-size:small;
}

.import
{
text-align:right;
}


</style>
</head>
<body>
<div id="fattura-container">

<xsl:choose>
<xsl:when test="d:FatturaElettronicaSemplificata">
<!--versione 1.0 SEMPLIFICATA-->
<xsl:call-template name="FatturaElettronica">
<xsl:with-param name="TipoFattura" select="d:FatturaElettronicaSemplificata" />
<xsl:with-param name="IsFPRS" select="1" />
</xsl:call-template>
</xsl:when>
<xsl:when test="c:FatturaElettronica">
<!--versione 1.0-->
<xsl:call-template name="FatturaElettronica">
<xsl:with-param name="TipoFattura" select="c:FatturaElettronica" />
<xsl:with-param name="IsFPRS" select="0" />
</xsl:call-template>
</xsl:when>
<xsl:when test="b:FatturaElettronica">
<!--versione 1.1-->
<xsl:call-template name="FatturaElettronica">
<xsl:with-param name="TipoFattura" select="b:FatturaElettronica" />
<xsl:with-param name="IsFPRS" select="0" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="FatturaElettronica">
<!--versione 1.2-->
<xsl:with-param name="TipoFattura" select="a:FatturaElettronica" />
<xsl:with-param name="IsFPRS" select="0" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>



</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

casanmaner

unread,
Feb 3, 2019, 4:51:45 AM2/3/19
to
Il giorno domenica 3 febbraio 2019 10:40:39 UTC+1, draleo ha scritto:
> a e quella di Bruno di un altro post

Se il riferimento a quella di Bruno è Attachment-To-PDF allora forse potrebbe esserti più utile.
La procedura che ha pubblicato Bruno e il file che ho "linkato" io servono per estrarre gli allegati presenti un una fattura elettronica.
In particolare il file che ho indicato io scarica tutti gli allegati presenti in un file fattura elettronica creando una cartella con il nome del file e inserendovi tutti i vari allegati indicanti nel tag <Allegati> presenti nell'xml.

draleo

unread,
Feb 3, 2019, 5:05:45 AM2/3/19
to
Grandi ! Allora ci provo. Grazie
draleo

Bruno Campanini

unread,
Feb 5, 2019, 12:43:46 AM2/5/19
to
It happens that casanmaner formulated :
Mi fai venire un dubbio.
L'unico programma di emissione FE che conosco è quello messo a
disposizione dall'ADE, versione 2.
Col quale è possibile allegare un solo file PDF, dimensione
massima 6mb.
Con altri più evoluti, che non conosco, è possibile allegare
più di un file, o il tuo plurale si riferisce alla possibilità
di aver più allegati in unico file pdf?

Bruno

casanmaner

unread,
Feb 5, 2019, 2:09:25 AM2/5/19
to
Ciao Bruno,
è possibile inserire "infiniti" allegati basta non superare la dimensione massima del file di 5MB.
Immagino tu ti riferisca al programma "PC".
Se tu utilizzassi ad esempio la funzionalità Web per emettere le fatture (tramite Fatture e Corrispettivi) potresti inserire più allegati.

Per questo con il mio file ho previsto la possibilità di estrarre tutti gli allegati eventualmente previsti.
ciao

casanmaner

unread,
Feb 5, 2019, 2:11:12 AM2/5/19
to
Aggiungo che gli allegati potrebbero essere anche diversi da un pdf.
Potrebbero essere csv, xls, zippati o meno.

ciao

Bruno Campanini

unread,
Feb 5, 2019, 4:26:34 AM2/5/19
to
casanmaner has brought this to us :

>>> Se il riferimento a quella di Bruno è Attachment-To-PDF allora forse
>>> potrebbe esserti più utile. La procedura che ha pubblicato Bruno e il file
>>> che ho "linkato" io servono per estrarre gli allegati presenti un una
>>> fattura elettronica. In particolare il file che ho indicato io scarica
>>> tutti gli allegati presenti in un file fattura elettronica creando una
>>> cartella con il nome del file e inserendovi tutti i vari allegati
>>> indicanti nel tag <Allegati> presenti nell'xml.
>>
>> Mi fai venire un dubbio.
>> L'unico programma di emissione FE che conosco è quello messo a
>> disposizione dall'ADE, versione 2.
>> Col quale è possibile allegare un solo file PDF, dimensione
>> massima 6mb.
>> Con altri più evoluti, che non conosco, è possibile allegare
>> più di un file, o il tuo plurale si riferisce alla possibilità
>> di aver più allegati in unico file pdf?
>>
>> Bruno
>
> Ciao Bruno,
> è possibile inserire "infiniti" allegati basta non superare la dimensione
> massima del file di 5MB. Immagino tu ti riferisca al programma "PC".
> Se tu utilizzassi ad esempio la funzionalità Web per emettere le fatture
> (tramite Fatture e Corrispettivi) potresti inserire più allegati.
Mi riferisco a questo:
https://www.agenziaentrate.gov.it/wps/content/nsilib/nsi/schede/comunicazioni/fatture+e+corrispettivi/software+compilazione+fattura+elettronica
rilevata or ora la v2.01 del 01-02-19.

Riceve un solo file in allegato, max 5 mb (prima erano 6mb),
ma qui si naviga a vista.

Ma anche da F&C, testé visitato, è ammesso
un solo allegato... oddio così mi sembra (questa mattina non
ho ancora bevuto).

Bruno

casanmaner

unread,
Feb 5, 2019, 6:14:30 AM2/5/19
to
Il giorno martedì 5 febbraio 2019 10:26:34 UTC+1, Bruno Campanini ha scritto:

> un solo allegato... oddio così mi sembra (questa mattina non
> ho ancora bevuto).
>
Sì, hai ragione Bruno.
Anche il programma web consente un solo allegato.
Però nelle specifiche quello è un campo ripetibile N volte:
2.5 <Allegati> Dati relativi ad eventuali allegati <0.N>
2.5.1 <NomeAttachment> xs:normalizedString Nome dell'allegato formato alfanumerico <1.1> 1 … 60
2.5.2 <AlgoritmoCompressione> xs:string Algoritmo usato per comprimere l'attachment (ad es.: ZIP, RAR, …) formato alfanumerico <0.1> 1 … 10
2.5.3 <FormatoAttachment> xs:string Formato dell'attachment (ad es: TXT, XML, DOC, PDF …….) formato alfanumerico <0.1> 1 … 10
2.5.4 <DescrizioneAttachment> xs:normalizedString Descrizione del documento formato alfanumerico <0.1> 1 … 100
2.5.5 <Attachment> xs:base64Binary Contiene il documento allegato alla fattura; il contenuto è demandato agli accordi tra PA e fornitore base64Binary [RFC 2045] <1.1> valore vincolato alla dimensione max prevista per la fattura elettronica


Per le dimensioni massime della fattura questa è di 5MB per la trasmissione via Web.
Nel caso di invio delle fatture tramite PEC l'email deve "pesare" al massimo 30MB.

Almeno da quanto qui riportato:

https://www.fatturapa.gov.it/export/fatturazione/it/c-13.htm

mau1791

unread,
Oct 11, 2020, 6:59:42 AM10/11/20
to
Riprendendo l'ottimo contributo di Casanmaner (e Bruno) , alla luce della nuova versione 1.6.1 del tracciato XML chiedo come adeguare tale nuovo controllo.
Grazie Maurizio

casanmaner

unread,
Oct 11, 2020, 12:15:22 PM10/11/20
to
Il giorno domenica 11 ottobre 2020 12:59:42 UTC+2, mau1791 ha scritto:
> Riprendendo l'ottimo contributo di Casanmaner (e Bruno) , alla luce della nuova versione 1.6.1 del tracciato XML chiedo come adeguare tale nuovo controllo.
> Grazie Maurizio

Io ho sostituito nella cartella di lavoro il precedente schema xsd con quello nuovo (dopo averlo modificato eliminando i riferimenti alla signature).

Vedi questo xsd modificato:

https://www.dropbox.com/s/ejv7zwdw57n4067/Schema_VFPR12_1.6.1_mod.xsd?dl=0

mau1791

unread,
Oct 11, 2020, 1:46:10 PM10/11/20
to
Ciao casanmaner ,
grazie per la pronta risposta; una info: ho provato a creare una fattura datata 31/10/20 e lasciando il vecchio codice
N6 x Art.74 co.7,8 (cessioni rottami, metalli ferrosi e non) in luogo del nuovo N6.1
ma NON ho avuto alcuna segnalazione: <!-- IL CODICE SEGUENTE (N6) NON SARA' PIU' VALIDO A PARTIRE DAL PRIMO GENNAIO 2021-->

casanmaner

unread,
Oct 11, 2020, 3:02:40 PM10/11/20
to
Ma oggi è ancora valido e lo schema presenta ancora i codici generici.
Non so a partire dal prossimo anno prevederanno un nuovo schema dove i generici N6 e N3 non saranno più presenti tra i codici ammessi.

mau1791

unread,
Oct 11, 2020, 3:15:20 PM10/11/20
to
Hai ragione mio errore ! Perfetto!

Final Job

unread,
Oct 12, 2020, 2:35:21 PM10/12/20
to
Scusate se vado fuori tema ma non riesco più a vedere i post precedenti
dello stesso argomento.

A parte il non capire perchè sia successo, e vedrò di arrivarci, come
fare a recuperarli?

Grazie
Ale

Final Job

unread,
Oct 12, 2020, 4:17:35 PM10/12/20
to
risolvo da web
grazie
Ale

Entraide Social

unread,
Oct 13, 2020, 9:08:14 PM10/13/20
to
Buongiorno
Hai un progetto per il quale sei desideroso di chiedere un finanziamento o un prestito? Mi chiamo Duhovic Michael, ho un capitale di 19.000.000 di euro che serve per fare prestiti da 2.000 euro a 1.700.000,00 euro a qualsiasi persona seria con un interesse del 3%. Se hai bisogno di un prestito, tieni presente le aree in cui posso aiutarti: * Finanza * Mutui per la casa * Prestiti per investimenti * Prestito per auto * Consolidamento debiti * Linea di credito * Seconda ipoteca * Riacquisto del credito * Prestiti personali.
contattami via e-mail: duhovic...@gmail.com

mau1791

unread,
Nov 25, 2020, 1:37:55 PM11/25/20
to
Ciao casanmaner,
proseguendo con le nuove Specifiche tecniche versione 1.6.2 del tracciato XML è possibile aggiornare quanto già fatto sul precedente 1.6.1 ?
grazie. maurizio

casanmaner

unread,
Nov 25, 2020, 4:24:54 PM11/25/20
to
Il giorno mercoledì 25 novembre 2020 alle 19:37:55 UTC+1 mau1791 ha scritto:

> Ciao casanmaner,
> proseguendo con le nuove Specifiche tecniche versione 1.6.2 del tracciato XML è possibile aggiornare quanto già fatto sul precedente 1.6.1 ?
> grazie. maurizio
Ciao
io sto usando questa versione modificata del file xsd
https://www.dropbox.com/s/3h1okwvzjpbsedt/Schema_VFPR12_1.6.2_mod.xsd?dl=0

mau1791

unread,
Nov 26, 2020, 2:48:10 PM11/26/20
to
Sempre grazie.

mau1791

unread,
Sep 10, 2021, 2:00:24 PM9/10/21
to
Buonasera,
casanmaner e tutti coloro a cui fosse di interesse:
proseguendo con le nuove Specifiche tecniche versione 1.6.3 del tracciato XML è possibile aggiornare quanto già fatto sul precedente 1.6.2 ?

grazie. Maurizio

casanmaner

unread,
Sep 12, 2021, 9:26:18 AM9/12/21
to

mau1791

unread,
Sep 12, 2021, 1:47:37 PM9/12/21
to
perfetto grazie 1000

mau1791

unread,
Jan 8, 2022, 8:13:04 AM1/8/22
to
Ciao casanmaner
proseguendo con le nuove Specifiche tecniche versione 1.6.4 - Provvedimento del 23 dicembre 2021 v. 1.6.4 del tracciato XML è possibile aggiornare quanto già fatto sul precedente 1.6.3 ?

grazie. Maurizio

casanmaner

unread,
Jan 10, 2022, 12:13:14 PM1/10/22
to

mau1791

unread,
Jan 10, 2022, 2:31:26 PM1/10/22
to
Grazie,
ma noto essere identico al precedente 1.6.3. (?!)

casanmaner

unread,
Jan 11, 2022, 4:01:31 AM1/11/22
to
Infatti credo che non ci sia nessuna reale modifica allo schema.

casanmaner

unread,
Jan 11, 2022, 4:06:51 AM1/11/22
to
Il giorno martedì 11 gennaio 2022 alle 10:01:31 UTC+1 casanmaner ha scritto:

> Infatti credo che non ci sia nessuna reale modifica allo schema.
Questo il link alle specifiche 1.6.3
https://www.agenziaentrate.gov.it/portale/web/guest/specifiche-tecniche-versione-1.6.3

Questo il link alle specifiche 1.6.4
https://www.agenziaentrate.gov.it/portale/web/guest/specifiche-tecniche-versione-1.6.4-provvedimento-del-23-dicembre-2021

Lo schema xsd risulta in entrambe le sezioni aggiornato al 7 luglio 2021.

mau1791

unread,
Jan 11, 2022, 4:48:54 PM1/11/22
to
Attendiamo che i funzionari dell'ADE aggiornino quanto dovuto.

casanmaner

unread,
Jan 12, 2022, 11:14:50 AM1/12/22
to
Penso che in realtà lo schema rimarrà invariato.
L'eventuale errore con scarto avverrà solo in fase di controllo "interno" al momento della trasmissione del file.

mau1791

unread,
Jan 12, 2022, 11:19:52 AM1/12/22
to
Se così fosse... mi mancherà un prezioso pre-controllo di pre-invio.

casanmaner

unread,
Jan 12, 2022, 11:35:31 AM1/12/22
to
La stessa cosa accade con la validità/esistenza del codice fiscale o partita iva.
Il problema qui è la verifica della lettera d'intento che può essere fatta solo una volta ricevuto il file.
Per una verifica ante invio dovresti provare ad utilizzare le funzionalità AdE per il controllo degli xml, accedendo a fatture e corrispettivi.

mau1791

unread,
Jan 12, 2022, 11:39:31 AM1/12/22
to
Ok grazie; dunque si prospetta un controllo preventivo e MANUALE su http://telematici.agenziaentrate.gov.it/VerIntent/VerificaIntent.do?evento=carica

mau1791

unread,
Sep 29, 2022, 2:09:59 AM9/29/22
to
Ciao casanmaner
per la Documentazione utilizzabile dal 1° ottobre 2022 con le nuove Specifiche tecniche versione Specifiche tecniche vers 1.7.1
--> https://www.agenziaentrate.gov.it/portale/web/guest/specifiche-tecniche-versione-1.7.1
posso chiederti di aggiornare cortesemente quanto già fatto sul precedente 1.6.4?

grazie. Maurizio

casanmaner

unread,
Sep 29, 2022, 11:56:53 AM9/29/22
to
Il giorno giovedì 29 settembre 2022 alle 08:09:59 UTC+2 mauriz...@infinito.it ha scritto:

> > Ok grazie; dunque si prospetta un controllo preventivo e MANUALE su http://telematici.agenziaentrate.gov.it/VerIntent/VerificaIntent.do?evento=carica
> Ciao casanmaner
> per la Documentazione utilizzabile dal 1° ottobre 2022 con le nuove Specifiche tecniche versione Specifiche tecniche vers 1.7.1
> --> https://www.agenziaentrate.gov.it/portale/web/guest/specifiche-tecniche-versione-1.7.1
> posso chiederti di aggiornare cortesemente quanto già fatto sul precedente 1.6.4?
>
> grazie. Maurizio

Ciao,
prova a vedere se va bene

https://www.dropbox.com/s/vnq9lmzuzjfioaj/Schema_VFPR12_1.7.1_Mod.xsd?dl=0

Inf

unread,
Feb 10, 2024, 1:15:56 PMFeb 10
to
Il giorno giovedì 29 settembre 2022 alle 17:56:53 UTC+2 casanmaner ha scritto:
Ciao casanmaner
proseguendo con le nuove ed ulteriori Specifiche tecniche versione 1.8 dal 01/02/2024:
https://www.agenziaentrate.gov.it/portale/specifiche-tecniche-versione-1.8
ti è possibile aggiornare quanto già fatto sul precedente 1.7.1 ?

grazie. Maurizio

casanmaner

unread,
Feb 11, 2024, 4:22:32 AMFeb 11
to
Ciao,
ho fatto un confronto testuale, tramite word, e tra i due xsd non c'è
nessuna differenza.

Inf

unread,
Feb 11, 2024, 4:24:15 AMFeb 11
to
OK, grazie, allora semplicemente rinominerò il file xsd
0 new messages