--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY nbsp " ">
+]>
+
+<xsl:transform
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:java="xalan://xml.apache.org/xalan/java"
+ xmlns:fn="http://projets.admisource.gouv.fr/xemelios/namespaces#functions"
+ xmlns:added="http://projets.admisource.gouv.fr/xemelios/namespaces#added"
+ xmlns:ano="http://projets.admisource.gouv.fr/xemelios/namspaces#anomally"
+ xmlns:n="http://www.minefi.gouv.fr/cp/helios/pes_v2/facture"
+ xmlns="http://www.minefi.gouv.fr/cp/helios/pes_v2/facture"
+ exclude-result-prefixes="fn java" version="2.0">
+ <!-- xmlns:xem="http://admisource.gouv.fr/projects/xemelios/ext" -->
+ <!--xsl:param name="encoding" select="'UTF-8'"/-->
+
+ <xsl:output method="xml" indent="yes"/>
+
+
+ <!-- xsl:output encoding="ISO-8859-1"/>
+ <xsl:output version="1.0"/-->
+ <xsl:param name="language" select="'fr'"/>
+
+ <xsl:template match="/*[position()=1]">
+ <xsl:if test="local-name() = 'DOC_PES_Facture'">
+ <DOC_PES_Facture xmlns="http://www.minefi.gouv.fr/cp/helios/pes_v2/facture"
+ xmlns:added="http://projets.admisource.gouv.fr/xemelios/namespaces#added"
+ xmlns:n="http://www.minefi.gouv.fr/cp/helios/pes_v2/facture"
+ xmlns:ano="http://projets.admisource.gouv.fr/xemelios/namespaces#anomally">
+ <xsl:for-each select="./@*">
+ <xsl:attribute name="{local-name(.)}" namespace="{namespace-uri(.)}" select="."/>
+ </xsl:for-each>
+ <xsl:for-each select="./*">
+ <xsl:call-template name="writeElement">
+ <xsl:with-param name="el" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </DOC_PES_Facture>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="writeElement">
+ <xsl:param name="el"/>
+ <xsl:choose>
+ <xsl:when test="namespace-uri($el) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally'">
+ <xsl:element name="{name($el)}" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#anomally">
+ <xsl:for-each select="$el/@*">
+ <xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:for-each>
+ <xsl:value-of select="text()" disable-output-escaping="yes"/>
+ <xsl:for-each select="$el/*">
+ <xsl:call-template name="writeElement"><xsl:with-param name="el" select="."/></xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{name($el)}" namespace="http://www.minefi.gouv.fr/cp/helios/pes_v2/facture">
+ <xsl:attribute name="generated-id" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:if test="name($el)='PESFacture'">
+ <xsl:attribute name="primarykey" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="./n:Date/@V"/><xsl:value-of select="./n:Emetteur/n:InfoTiers/n:IdTiers/@V"/><xsl:value-of select="./n:Tiers[n:TypeTiersFacture/@V=10]/n:InfoTiers/n:IdTiers/@V"/>
+ </xsl:attribute>
+ <xsl:attribute name="montantHT" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="format-number(sum(./n:FactureIndiv/n:TotalAPayer/n:MtTotalHT/@V),'####.##')"/>
+ </xsl:attribute>
+ <xsl:attribute name="montantTVA" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="format-number(sum(./n:FactureIndiv/n:TotalAPayer/n:MtTotalTVA/@V),'####.##')"/>
+ </xsl:attribute>
+ <xsl:attribute name="montantTTC" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="format-number(sum(./n:FactureIndiv/n:TotalAPayer/n:MtTotalTTC/@V),'####.##')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="name($el)='FactureIndiv'">
+ <xsl:attribute name="moisDateEmission" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#added">
+ <xsl:value-of select="substring(string($el/n:DateEmission/@V), 6, 2)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="$el/@*">
+ <xsl:choose>
+ <xsl:when test="namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally'">
+ <xsl:attribute name="{local-name(.)}" namespace="http://projets.admisource.gouv.fr/xemelios/namespaces#anomally">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{local-name(.)}" namespace="{namespace-uri(.)}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="$el/*">
+ <xsl:call-template name="writeElement">
+ <xsl:with-param name="el" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:value-of select="$el/text()" disable-output-escaping="yes"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+</xsl:transform>