--- /dev/null
+<?xml version="1.1" encoding="iso-8859-1"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY nbsp " ">
+]>
+
+<xsl:transform
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:java="xalan://xml.apache.org/xalan/java"
+ xmlns="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0"
+ xmlns:n="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0"
+ xmlns:added="http://projets.admisource.gouv.fr/xemelios/namspaces#added"
+ xmlns:ano="http://projets.admisource.gouv.fr/xemelios/namspaces#anomally"
+ exclude-result-prefixes="java xsl"
+ version="2.0"
+ >
+ <xsl:output
+ method="xml"
+ encoding="ISO-8859-1"
+ indent="yes"
+ />
+ <xsl:output version="1.0"/>
+ <xsl:param name="language" select="'fr'"/>
+ <xsl:param name="CodeBudget"/>
+ <xsl:param name="LibelleBudget"/>
+ <xsl:param name="CodeCollectivite"/>
+ <xsl:param name="LibelleCollectivite"/>
+
+ <xsl:template match="/*[position()=1]">
+ <xsl:choose>
+ <xsl:when test="local-name()='EtatVersement'">
+ <EtatVersement
+ xmlns="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0"
+ xmlns:n="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0"
+ xmlns:added="http://projets.admisource.gouv.fr/xemelios/namspaces#added"
+ xmlns:ano="http://projets.admisource.gouv.fr/xemelios/namspaces#anomally">
+
+ <xsl:if test="not(Budget) and string-length($CodeBudget) > 0">
+ <xsl:element name="Budget" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:element name="Libelle" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="$LibelleBudget"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="Code" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="$CodeBudget"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="./*">
+ <xsl:call-template name="writeElement">
+ <xsl:with-param name="el" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </EtatVersement></xsl:when>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <xsl:template name="writeElement">
+ <xsl:param name="el"/>
+ <xsl:element name="{name($el)}" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:for-each select="$el/@*">
+ <!--xsl:value-of select="name(.)"/-->
+ <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="contains('|Versement|Beneficiaire|DetailMt|PJRef|Totalisation',concat('|',name($el)))"><xsl:attribute name="generated-id"><xsl:value-of select="generate-id()"/></xsl:attribute><!--xsl:attribute name="tag-name"><xsl:value-of select="name($el)"/></xsl:attribute--></xsl:when>
+ <!--xsl:when test="contains('|Nom|Prenom|ComplNom|',concat('|',name($el),'|'))"><xsl:attribute name="V2"><xsl:value-of select="upper-case($el/@V)"/></xsl:attribute></xsl:when-->
+ <xsl:when test="name(.)='Sequence'">
+ <xsl:attribute name="V"><xsl:value-of select="NumOrdre/@V"/> / <xsl:value-of select="NbTotal/@V"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains('|Versement',concat('|',name($el)))">
+ <xsl:choose>
+ <xsl:when test="exists($el/Destinataire/CpteBancaire)">
+ <xsl:call-template name="compte">
+ <xsl:with-param name="cpte" select="$el/Destinataire/CpteBancaire"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="exists($el/Beneficiaire[1]/CpteBancaire)">
+ <xsl:call-template name="compte">
+ <xsl:with-param name="cpte" select="$el/Beneficiaire[1]/CpteBancaire"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="Mois" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V" select="substring(./*[name()='Date']/@V,6,2)"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains('|Versement|Repartition',concat('|',name($el)))">
+ <xsl:element name="Annee" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Annee/@V"/></xsl:attribute>
+ </xsl:element>
+ <!--xsl:if test="not(exists(Prestation))"-->
+ <xsl:element name="Prestation-principale" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:element name="Libelle" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Prestation/Libelle/@V"></xsl:value-of></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="Code" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Prestation/Code/@V"></xsl:value-of></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <!--/xsl:if-->
+ <xsl:if test="not(exists(Sequence))">
+ <xsl:element name="Sequence" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Sequence/NumOrdre/@V"/> / <xsl:value-of select="../../Sequence/NbTotal/@V"/></xsl:attribute>
+ <xsl:element name="NumOrdre" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Sequence/NumOrdre/@V"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="NbTotal" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="V"><xsl:value-of select="../../Sequence/NbTotal/@V"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <!--xsl:choose>
+ <xsl:when test="contains('|CptBancaire',concat('|',name($el)))"><xsl:attribute name="rib"><xsl:value-of select="$el/CodeEtab/@V"/><xsl:value-of select="$el/CodeGuic/@V"/><xsl:value-of select="$el/IdCpte/@V"/><xsl:value-of select="$el/CleRib/@V"/></xsl:attribute></xsl:when>
+ </xsl:choose-->
+ <!--xsl:choose>
+ <xsl:when test="name($el)='RefNomenStatutaire'"><xsl:attribute name="desc"><xsl:value-of select="$el/Libelle/@V"/><xsl:text> (</xsl:text><xsl:value-of select="$el/Code/@V"/><xsl:text>)</xsl:text></xsl:attribute></xsl:when>
+ </xsl:choose-->
+ <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()"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="compte">
+ <xsl:param name="cpte"></xsl:param>
+ <xsl:element name="CpteBancaire" namespace="http://www.minefi.gouv.fr/cp/helios/pes/versement/1.0">
+ <xsl:attribute name="rib">
+ <xsl:choose>
+ <xsl:when test="not(exists($cpte/@type)) or $cpte/@type='BBAN'"><xsl:value-of select="$cpte/CodeEtab/@V"/><xsl:value-of select="$cpte/CodeGuic/@V"/><xsl:value-of select="$cpte/IdCpte/@V"/><xsl:value-of select="$cpte/CleRib/@V"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$cpte/Id/@V"></xsl:value-of></xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+</xsl:transform>
\ No newline at end of file