<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:n="http://www.minefi.gouv.fr/cp/helios/pes_v2/Rev0/aller"
    xmlns:added="http://projets.admisource.gouv.fr/xemelios/namespaces#added"
    xmlns:ano="http://projets.admisource.gouv.fr/xemelios/namespaces#anomally"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:xad="http://uri.etsi.org/01903/v1.1.1#"
    xmlns:data="data.uri"
    xmlns:xem="fr.gouv.finances.dgfip.utils.xml.certs.Certificate509"
    version="2.0">
    <xsl:param name="elementId"/> <!-- 'Bordereau' pour afficher le bordereau, vide sinon -->
    <xsl:param name="primaryKey" />    <!-- utilise dans le cas d'un document multi-bordereau -->
    <xsl:param name="mandatId"/>  <!-- dans le cas de l'affichage d'un mandat, l'id du mandat (./n:PES_DepenseAller/n:Bordereau/n:Piece/n:BlocPiece/n:InfoPce/n:IdPce/@V ) -->
    <xsl:param name="browser-destination" />
    <xsl:param name="anoId"/>    <!-- id de l'anomalie a mettre en surbrillance -->
    <xsl:output encoding="ISO-8859-1" method="xhtml" exclude-result-prefixes="n added ano data" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" include-content-type="no" indent="yes"/>
    <xsl:decimal-format name="decformat" 
        decimal-separator="," 
        grouping-separator=" " 
        digit="#" 
        pattern-separator=";" 
        NaN="NaN" 
        minus-sign="-"/>
    <xsl:variable name="tags-ano">
        <xsl:for-each select="//ano:Anomalie[@ano:anoId = $anoId]/ano:node">
            <xsl:element name="node">
                <xsl:attribute name="id" select="./@ano:id"/>
            </xsl:element>
        </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="bordereau" select="/n:PES_Aller/n:PES_DepenseAller/n:Bordereau[(string-length($primaryKey) &gt; 1 and @added:primary-key=$primaryKey) or (string-length($primaryKey) = 0 and position()=1) ][1]"></xsl:variable>
    <xsl:variable name="PES" select="/PES-aller"/>
    <!-- Donnees pour les equivalences des codes -->
    <xsl:variable name="data">
    <data:data>
        <data:typeBordereau>
            <data:t type="01">Ordinaire</data:t>
            <data:t type="02">Annulation/r&#233;duction</data:t>
            <data:t type="03">Ordres de paiement</data:t>
            <data:t type="04">Bordereau de r&#233;gularisation</data:t>
        </data:typeBordereau>
        <data:typePiece>
            <data:t type="01">Mandat ordinaire</data:t>
            <data:t type="02">Mandat correctif</data:t>
            <data:t type="03">Mandat d&apos;ordre budg&#233;taire</data:t>
            <data:t type="04">Mandat d&apos;ordre mixte</data:t>
            <data:t type="05">Mandat &#233;mis apr&#232;s paiement</data:t>
            <data:t type="06">Mandat global</data:t>
            <data:t type="07">Mandat d&apos;admission en non valeurs</data:t>
            <data:t type="08">Mandat collectif</data:t>
            <data:t type="09">Mandat sur march&#233;</data:t>
            <data:t type="10">Mandat de rattachement</data:t>
            <data:t type="11">Ordre de paiement</data:t>
            <data:t type="12">Demande &#233;mission mandat</data:t>
            <data:t type="13">Charges constat&#233;es d&apos;avance</data:t>
        </data:typePiece>
        <data:naturePiece>
            <data:n type="01">Fonctionnement</data:n>
            <data:n type="02">Investissement</data:n>
            <data:n type="03">Inventaire</data:n>
            <data:n type="04">Emprunt</data:n>
            <data:n type="O5">R&#233;gie</data:n>
            <data:n type="06">Annulation-R&#233;duction</data:n>
            <data:n type="07">Compl&#233;mentaire</data:n>
            <data:n type="08">R&#233;&#233;mis</data:n>
            <data:n type="09">Annulant un titre</data:n>
            <data:n type="10">Annulation du mandat de rattachement</data:n>
            <data:n type="11">Paie</data:n>
            <data:n type="12">Retenue de garantie</data:n>
            <data:n type="13">Dernier acompte sur march&#233;</data:n>
            <data:n type="14">Avance forfaitaire</data:n>
            <data:n type="15">Autres</data:n>
            <data:n type="18">Cession</data:n>
        </data:naturePiece>
        <data:typePieceOrigine>
            <data:t type="01">Mandat</data:t>
            <data:t type="02">Titre</data:t>
            <data:t type="03">Paiement</data:t>
            <data:t type="04">Liste non valeur</data:t>
        </data:typePieceOrigine>
        <data:typeTiersNational>
            <data:t type="01">Siret</data:t>
            <data:t type="02">Siren</data:t>
            <data:t type="03">Finess</data:t>
            <data:t type="04">Nir</data:t>
        </data:typeTiersNational>
        <data:categorieTiers>
            <data:c V="01">Personnes physiques</data:c>
            <data:c V="20">&#233;tat et &#233;tablissements publics nationaux</data:c>
            <data:c V="21">R&#233;gions</data:c>
            <data:c V="22">D&#233;partements</data:c>
            <data:c V="23">Communes</data:c>
            <data:c V="24">Groupements de collectivit&#233;s</data:c>
            <data:c V="25">Caisses des &#233;coles</data:c>
            <data:c V="26">CCAS</data:c>
            <data:c V="27">Etablissements publics de sant&#233;</data:c>
            <data:c V="28">Ecole nationale de la sant&#233; publique</data:c>
            <data:c V="29">Autres &#233;tablissements publics et organismes internationaux</data:c>
            <data:c V="50">Personnes morales de droit priv&#233; autres qu'organismes sociaux</data:c>
            <data:c V="60">Caisses de s&#233;curit&#233; sociale r&#233;gime g&#233;n&#233;ral</data:c>
            <data:c V="61">Caisses de s&#233;curit&#233; sociale r&#233;gime agricole</data:c>
            <data:c V="62">S&#233;curit&#233; sociale des travailleurs non salari&#233;s et professions non agricoles</data:c>
            <data:c V="63">Autres r&#233;gimes obligatoires de s&#233;curit&#233; sociale</data:c>
            <data:c V="64">Mutuelles et organismes d'assurance</data:c>
            <data:c V="65">Divers autres tiers payants</data:c>
            <data:c V="70">CNRACL</data:c>
            <data:c V="71">IRCANTEC</data:c>
            <data:c V="72">ASSEDIC</data:c>
            <data:c V="73">Caisses mutualistes de retraite compl&#233;mentaires</data:c>
            <data:c V="74">Autres organismes sociaux</data:c>
        </data:categorieTiers>
        <data:natureJuridiqueTiers>
            <data:t V="00">Inconnue</data:t>
            <data:t V="01">Particuliers</data:t>
            <data:t V="02">Artisan / Commerçant / Agriculteur</data:t>
            <data:t V="03">Soci&#233;t&#233;</data:t>
            <data:t V="04">CAM ou caisse appliquant les m&#234;mes r&#232;gles</data:t>
            <data:t V="05">Caisse compl&#233;mentaire</data:t>
            <data:t V="06">Association</data:t>
            <data:t V="07">Etat ou organisme d&apos;Etat</data:t>
            <data:t V="08">Etablissement public national</data:t>
            <data:t V="09">Collectivit&#233; territoriale / EPL / EPS</data:t>
            <data:t V="10">Etat &#233;tranger / ambassade</data:t>
            <data:t V="11">CAF</data:t>
        </data:natureJuridiqueTiers>
        <data:codePaysINSEE>
            <data:p V="99125">ALBANIE</data:p>
            <data:p V="99109">ALLEMAGNE</data:p>
            <data:p V="99130">ANDORRE</data:p>
            <data:p V="99110">AUTRICHE</data:p>
            <data:p V="99131">BELGIQUE</data:p>
            <data:p V="99148">BIELORUSSIE</data:p>
            <data:p V="99118">BOSNIE-HERZEGOVINE</data:p>
            <data:p V="99103">BOUVET (ILE)</data:p>
            <data:p V="99111">BULGARIE</data:p>
            <data:p V="99119">CROATIE</data:p>
            <data:p V="99101">DANEMARK</data:p>
            <data:p V="99134">ESPAGNE</data:p>
            <data:p V="99106">ESTONIE</data:p>
            <data:p V="99156">EX-REPUBLIQUE YOUGOSLAVE DE MACEDOINE</data:p>
            <data:p V="99101">FEROE (ILES)</data:p>
            <data:p V="99105">FINLANDE</data:p>
            <data:p V="99133">GIBRALTAR</data:p>
            <data:p V="99126">GRECE</data:p>
            <data:p V="99112">HONGRIE</data:p>
            <data:p V="99136">IRLANDE, ou EIRE</data:p>
            <data:p V="99102">ISLANDE</data:p>
            <data:p V="99127">ITALIE</data:p>
            <data:p V="99107">LETTONIE</data:p>
            <data:p V="99113">LIECHTENSTEIN</data:p>
            <data:p V="99108">LITUANIE</data:p>
            <data:p V="99137">LUXEMBOURG</data:p>
            <data:p V="99144">MALTE</data:p>
            <data:p V="99151">MOLDAVIE</data:p>
            <data:p V="99138">MONACO</data:p>
            <data:p V="99120">MONTENEGRO</data:p>
            <data:p V="99103">NORVEGE</data:p>
            <data:p V="99135">PAYS-BAS</data:p>
            <data:p V="99122">POLOGNE</data:p>
            <data:p V="99139">PORTUGAL</data:p>
            <data:p V="99141">REPUBLIQUE DEMOCRATIQUE ALLEMANDE</data:p>
            <data:p V="99142">REPUBLIQUE FEDERALE D'ALLEMAGNE</data:p>
            <data:p V="99114">ROUMANIE</data:p>
            <data:p V="99132">ROYAUME-UNI</data:p>
            <data:p V="99123">RUSSIE</data:p>
            <data:p V="99128">SAINT-MARIN</data:p>
            <data:p V="99121">SERBIE-ET-MONTENEGRO</data:p>
            <data:p V="99117">SLOVAQUIE</data:p>
            <data:p V="99145">SLOVENIE</data:p>
            <data:p V="99104">SUEDE</data:p>
            <data:p V="99140">SUISSE</data:p>
            <data:p V="99103">SVALBARD et ILE JAN MAYEN</data:p>
            <data:p V="99115">TCHECOSLOVAQUIE</data:p>
            <data:p V="99116">TCHEQUE (REPUBLIQUE)</data:p>
            <data:p V="99124">TURQUIE D'EUROPE</data:p>
            <data:p V="99155">UKRAINE</data:p>
            <data:p V="99129">VATICAN, ou SAINT-SIEGE</data:p>
            <data:p V="99212">AFGHANISTAN</data:p>
            <data:p V="99201">ARABIE SAOUDITE</data:p>
            <data:p V="99252">ARMENIE</data:p>
            <data:p V="99253">AZERBAIDJAN</data:p>
            <data:p V="99249">BAHREIN</data:p>
            <data:p V="99246">BANGLADESH</data:p>
            <data:p V="99214">BHOUTAN</data:p>
            <data:p V="99224">BIRMANIE</data:p>
            <data:p V="99225">BRUNEI</data:p>
            <data:p V="99234">CAMBODGE</data:p>
            <data:p V="99216">CHINE</data:p>
            <data:p V="99254">CHYPRE</data:p>
            <data:p V="99237">COREE</data:p>
            <data:p V="99239">COREE (REPUBLIQUE DE)</data:p>
            <data:p V="99238">COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)</data:p>
            <data:p V="99247">EMIRATS ARABES UNIS</data:p>
            <data:p V="99228">ETATS MALAIS NON FEDERES</data:p>
            <data:p V="99255">GEORGIE</data:p>
            <data:p V="99223">GOA</data:p>
            <data:p V="99230">HONG-KONG</data:p>
            <data:p V="99223">INDE</data:p>
            <data:p V="99231">INDONESIE</data:p>
            <data:p V="99204">IRAN</data:p>
            <data:p V="99203">IRAQ</data:p>
            <data:p V="99207">ISRAEL</data:p>
            <data:p V="99217">JAPON</data:p>
            <data:p V="99222">JORDANIE</data:p>
            <data:p V="99211">KAMTCHATKA</data:p>
            <data:p V="99256">KAZAKHSTAN</data:p>
            <data:p V="99257">KIRGHIZISTAN</data:p>
            <data:p V="99240">KOWEIT</data:p>
            <data:p V="99241">LAOS</data:p>
            <data:p V="99205">LIBAN</data:p>
            <data:p V="99232">MACAO</data:p>
            <data:p V="99227">MALAISIE</data:p>
            <data:p V="99229">MALDIVES</data:p>
            <data:p V="99218">MANDCHOURIE</data:p>
            <data:p V="99242">MONGOLIE</data:p>
            <data:p V="99215">NEPAL</data:p>
            <data:p V="99250">OMAN</data:p>
            <data:p V="99258">OUZBEKISTAN</data:p>
            <data:p V="99213">PAKISTAN</data:p>
            <data:p V="99261">PALESTINE</data:p>
            <data:p V="99220">PHILIPPINES</data:p>
            <data:p V="99221">POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT</data:p>
            <data:p V="99248">QATAR</data:p>
            <data:p V="99209">SIBERIE</data:p>
            <data:p V="99226">SINGAPOUR</data:p>
            <data:p V="99235">SRI LANKA</data:p>
            <data:p V="99206">SYRIE</data:p>
            <data:p V="99259">TADJIKISTAN</data:p>
            <data:p V="99236">TAIWAN</data:p>
            <data:p V="99219">THAILANDE</data:p>
            <data:p V="99262">TIMOR ORIENTAL</data:p>
            <data:p V="99210">TURKESTAN RUSSE</data:p>
            <data:p V="99260">TURKMENISTAN</data:p>
            <data:p V="99208">TURQUIE</data:p>
            <data:p V="99243">VIET NAM</data:p>
            <data:p V="99244">VIET NAM DU NORD</data:p>
            <data:p V="99245">VIET NAM DU SUD</data:p>
            <data:p V="99251">YEMEN</data:p>
            <data:p V="99233">YEMEN DEMOCRATIQUE</data:p>
            <data:p V="99202">YEMEN (REPUBLIQUE ARABE DU)</data:p>
            <data:p V="99319">ACORES, MADERE</data:p>
            <data:p V="99303">AFRIQUE DU SUD</data:p>
            <data:p V="99352">ALGERIE</data:p>
            <data:p V="99395">ANGOLA</data:p>
            <data:p V="99327">BENIN</data:p>
            <data:p V="99347">BOTSWANA</data:p>
            <data:p V="99331">BURKINA</data:p>
            <data:p V="99321">BURUNDI</data:p>
            <data:p V="99322">CAMEROUN</data:p>
            <data:p V="99305">CAMEROUN ET TOGO</data:p>
            <data:p V="99313">CANARIES (ILES)</data:p>
            <data:p V="99396">CAP-VERT</data:p>
            <data:p V="99323">CENTRAFRICAINE (REPUBLIQUE)</data:p>
            <data:p V="99397">COMORES</data:p>
            <data:p V="99324">CONGO</data:p>
            <data:p V="99312">CONGO (REPUBLIQUE DEMOCRATIQUE)</data:p>
            <data:p V="99326">COTE D'IVOIRE</data:p>
            <data:p V="99399">DJIBOUTI</data:p>
            <data:p V="99301">EGYPTE</data:p>
            <data:p V="99317">ERYTHREE</data:p>
            <data:p V="99315">ETHIOPIE</data:p>
            <data:p V="99328">GABON</data:p>
            <data:p V="99304">GAMBIE</data:p>
            <data:p V="99329">GHANA</data:p>
            <data:p V="99330">GUINEE</data:p>
            <data:p V="99314">GUINEE EQUATORIALE</data:p>
            <data:p V="99392">GUINEE-BISSAU</data:p>
            <data:p V="99320">ILES PORTUGAISES DE L'OCEAN INDIEN</data:p>
            <data:p V="99332">KENYA</data:p>
            <data:p V="99348">LESOTHO</data:p>
            <data:p V="99302">LIBERIA</data:p>
            <data:p V="99316">LIBYE</data:p>
            <data:p V="99333">MADAGASCAR</data:p>
            <data:p V="99334">MALAWI</data:p>
            <data:p V="99335">MALI</data:p>
            <data:p V="99350">MAROC</data:p>
            <data:p V="99390">MAURICE</data:p>
            <data:p V="99336">MAURITANIE</data:p>
            <data:p V="99393">MOZAMBIQUE</data:p>
            <data:p V="99311">NAMIBIE</data:p>
            <data:p V="99337">NIGER</data:p>
            <data:p V="99338">NIGERIA</data:p>
            <data:p V="99308">OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')</data:p>
            <data:p V="99339">OUGANDA</data:p>
            <data:p V="99313">PRESIDES</data:p>
            <data:p V="99313">PROVINCES ESPAGNOLES D'AFRIQUE</data:p>
            <data:p V="99340">RWANDA</data:p>
            <data:p V="99389">SAHARA OCCIDENTAL</data:p>
            <data:p V="99306">SAINTE-HELENE</data:p>
            <data:p V="99394">SAO TOME-ET-PRINCIPE</data:p>
            <data:p V="99341">SENEGAL</data:p>
            <data:p V="99398">SEYCHELLES</data:p>
            <data:p V="99342">SIERRA LEONE</data:p>
            <data:p V="99318">SOMALIE</data:p>
            <data:p V="99343">SOUDAN</data:p>
            <data:p V="99307">SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA</data:p>
            <data:p V="99391">SWAZILAND</data:p>
            <data:p V="99325">TANGER</data:p>
            <data:p V="99309">TANZANIE</data:p>
            <data:p V="99344">TCHAD</data:p>
            <data:p V="99345">TOGO</data:p>
            <data:p V="99351">TUNISIE</data:p>
            <data:p V="99346">ZAMBIE</data:p>
            <data:p V="99308">ZANZIBAR</data:p>
            <data:p V="99310">ZIMBABWE</data:p>
            <data:p V="99404">ALASKA</data:p>
            <data:p V="99425">ANGUILLA</data:p>
            <data:p V="99441">ANTIGUA-ET-BARBUDA</data:p>
            <data:p V="99431">ANTILLES NEERLANDAISES</data:p>
            <data:p V="99415">ARGENTINE</data:p>
            <data:p V="99431">ARUBA</data:p>
            <data:p V="99436">BAHAMAS</data:p>
            <data:p V="99434">BARBADE</data:p>
            <data:p V="99429">BELIZE</data:p>
            <data:p V="99425">BERMUDES</data:p>
            <data:p V="99418">BOLIVIE</data:p>
            <data:p V="99416">BRESIL</data:p>
            <data:p V="99425">CAIMAN (ILES)</data:p>
            <data:p V="99401">CANADA</data:p>
            <data:p V="99417">CHILI</data:p>
            <data:p V="99419">COLOMBIE</data:p>
            <data:p V="99406">COSTA RICA</data:p>
            <data:p V="99407">CUBA</data:p>
            <data:p V="99408">DOMINICAINE (REPUBLIQUE)</data:p>
            <data:p V="99438">DOMINIQUE</data:p>
            <data:p V="99414">EL SALVADOR</data:p>
            <data:p V="99420">EQUATEUR</data:p>
            <data:p V="99404">ETATS-UNIS</data:p>
            <data:p V="99427">GEORGIE DU SUD ET LES ILES SANDWICH DU SUD</data:p>
            <data:p V="99435">GRENADE</data:p>
            <data:p V="99430">GROENLAND</data:p>
            <data:p V="99409">GUATEMALA</data:p>
            <data:p V="99428">GUYANA</data:p>
            <data:p V="99410">HAITI</data:p>
            <data:p V="99411">HONDURAS</data:p>
            <data:p V="99426">JAMAIQUE</data:p>
            <data:p V="99403">LABRADOR</data:p>
            <data:p V="99427">MALOUINES, OU FALKLAND (ILES)</data:p>
            <data:p V="99405">MEXIQUE</data:p>
            <data:p V="99425">MONTSERRAT</data:p>
            <data:p V="99412">NICARAGUA</data:p>
            <data:p V="99413">PANAMA</data:p>
            <data:p V="99421">PARAGUAY</data:p>
            <data:p V="99422">PEROU</data:p>
            <data:p V="99432">PORTO RICO</data:p>
            <data:p V="99442">SAINT-CHRISTOPHE-ET-NIEVES</data:p>
            <data:p V="99439">SAINTE-LUCIE</data:p>
            <data:p V="99440">SAINT-VINCENT-ET-LES GRENADINES</data:p>
            <data:p V="99437">SURINAME</data:p>
            <data:p V="99432">TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE</data:p>
            <data:p V="99427">TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD</data:p>
            <data:p V="99402">TERRE-NEUVE</data:p>
            <data:p V="99431">TERRITOIRE DES PAYS-BAS</data:p>
            <data:p V="99425">TERRITOIRES DU ROYAUME-UNI AUX ANTILLES</data:p>
            <data:p V="99433">TRINITE-ET-TOBAGO</data:p>
            <data:p V="99425">TURKS ET CAIQUES (ILES)</data:p>
            <data:p V="99423">URUGUAY</data:p>
            <data:p V="99424">VENEZUELA</data:p>
            <data:p V="99425">VIERGES BRITANNIQUES (ILES)</data:p>
            <data:p V="99432">VIERGES DES ETATS-UNIS (ILES)</data:p>
            <data:p V="99501">AUSTRALIE</data:p>
            <data:p V="99501">CHRISTMAS (ILE)</data:p>
            <data:p V="99501">COCOS ou KEELING (ILES)</data:p>
            <data:p V="99502">COOK (ILES)</data:p>
            <data:p V="99508">FIDJI</data:p>
            <data:p V="99505">GUAM</data:p>
            <data:p V="99504">HAWAII (ILES)</data:p>
            <data:p V="99501">HEARD ET MACDONALD (ILES)</data:p>
            <data:p V="99513">KIRIBATI</data:p>
            <data:p V="99505">MARIANNES DU NORD (ILES)</data:p>
            <data:p V="99515">MARSHALL (ILES)</data:p>
            <data:p V="99516">MICRONESIE (ETATS FEDERES DE)</data:p>
            <data:p V="99507">NAURU</data:p>
            <data:p V="99502">NIUE</data:p>
            <data:p V="99501">NORFOLK (ILE)</data:p>
            <data:p V="99502">NOUVELLE-ZELANDE</data:p>
            <data:p V="99517">PALAOS (ILES)</data:p>
            <data:p V="99510">PAPOUASIE-NOUVELLE-GUINEE</data:p>
            <data:p V="99503">PITCAIRN (ILE)</data:p>
            <data:p V="99512">SALOMON (ILES)</data:p>
            <data:p V="99505">SAMOA AMERICAINES</data:p>
            <data:p V="99506">SAMOA OCCIDENTALES</data:p>
            <data:p V="99505">TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE</data:p>
            <data:p V="99502">TOKELAU</data:p>
            <data:p V="99509">TONGA</data:p>
            <data:p V="99511">TUVALU</data:p>
            <data:p V="99514">VANUATU</data:p>
        </data:codePaysINSEE>
        <data:typeAdresse>
            <data:a V="0"></data:a>
            <data:a V="1">principal</data:a>
            <data:a V="2">secondaire</data:a>
        </data:typeAdresse>
        <data:moyenPaiement>
            <data:m type="01">Num&#233;raire</data:m>
            <data:m type="02">Ch&#232;que</data:m>
            <data:m type="03">Virement</data:m>
            <data:m type="04">Virement appli externe</data:m>
            <data:m type="05">Virement gros montant</data:m>
            <data:m type="06">Virement &#224; l&apos;&#233;tranger</data:m>
            <data:m type="07">Op&#233;ration budget rattach&#233;</data:m>
            <data:m type="08">Op&#233;ration d&apos;ordre</data:m>
            <data:m type="09">Autres</data:m>
            <data:m type="10">Pr&#233;l&#232;vement</data:m>
            <data:m type="11">Virement interne</data:m>
        </data:moyenPaiement>
    </data:data>
    </xsl:variable>
    
    <!-- template pour convertir le code du Type de bordereau en libell&#233; -->
    <xsl:template name="typeBordereauLibelle">
        <xsl:param name="typeBord"/>
        <xsl:value-of select="$data/data:data/data:typeBordereau/data:t[@type=$typeBord]/text()"/>
    </xsl:template>
    <!-- pour convertir le code du Type de pi&#232;ce en libell&#233; -->
    <xsl:template name="typePieceLibelle">
        <xsl:param name="typePiece"/>
        <xsl:value-of select="$data/data:data/data:typePiece/data:t[@type=$typePiece]/text()"/>
    </xsl:template>
    <!-- pour convertir le code de la nature de pi&#232;ce en libell&#233; -->
    <xsl:template name="naturePieceLibelle">
        <xsl:param name="naturePiece"/>
        <xsl:value-of select="$data/data:data/data:naturePiece/data:n[@type=$naturePiece]/text()"/>
    </xsl:template>
    <!-- pour convertir le type de pi&#232;ce d'origine en libell&#233; -->
    <xsl:template name="typePieceOrigine">
        <xsl:param name="typePiece"/>
        <xsl:value-of select="$data/data:data/data:typePieceOrigine/data:t[@type=$typePiece]/text()"/>
    </xsl:template>
    <!-- pour le type d'identifiant du tiers au niveau national -->
    <xsl:template name="typeTiersNational">
        <xsl:param name="typeTiers"/>
        <xsl:value-of select="$data/data:data/data:typeTiersNational/data:t[@type=$typeTiers]/text()"/>
    </xsl:template>
    <!-- cat&#233;gorie du tiers -->
    <xsl:template name="categorieTiers">
        <xsl:param name="catTiers"/>
        <xsl:value-of select="$data/data:data/data:categorieTiers/data:c[@V=$catTiers]/text()"/>
    </xsl:template>
    <!-- Nature juridique du tiers -->
    <xsl:template name="natureJuridiqueTiers">
        <xsl:param name="natJur"/>
        <xsl:value-of select="$data/data:data/data:natureJuridiqueTiers/data:t[@V=$natJur]/text()"/>
    </xsl:template>
    <!-- Correspondance entre le code de pays INSEE et son nom -->
    <xsl:template name="codePaysINSEE" xmlns:data="data.uri">
        <xsl:param name="codePays"/>
        <xsl:value-of select="$data/data:data/data:codePaysINSEE/data:p[@V=$codePays]/text()"/>
    </xsl:template>
    <!-- Type d'adresse -->
    <xsl:template name="typeAdresse">
        <xsl:param name="codeType"/>
        <xsl:value-of select="/data:data/data:typeAdresse/data:a[@V=$codeType]/text()"/>
    </xsl:template>
    <!-- pour le moyen de paiement -->
    <xsl:template name="moyenPaiement">
        <xsl:param name="typeMoyen"/>
        <xsl:value-of select="$data/data:data/data:moyenPaiement/data:m[@type=$typeMoyen]/text()"/>
    </xsl:template>

    <xsl:template name="slash-date">
        <xsl:param name="datebrute"/>
        <date xmlns:data="data.uri" xsl:exclude-result-prefixes="data">
            <xsl:value-of select="substring($datebrute, 9, 2)"/>
            <xsl:text>/</xsl:text>
            <xsl:value-of select="substring($datebrute, 6, 2)"/>
            <xsl:text>/</xsl:text>
            <xsl:value-of select="substring($datebrute, 1, 4)"/>
        </date>
    </xsl:template>
    <xsl:template name="number">
        <xsl:param name="num"/>
        <!--span style="background-color: #FF6666;">(<xsl:value-of select="$num"/>)</span-->
        <xsl:choose>
            <xsl:when test="count($num) &gt; 1"><span style="background-color: #FF6666;"><xsl:value-of select="$num"/></span></xsl:when>
            <xsl:when test="string-length(string($num)) = 0"/>
            <xsl:when test="number($num) = 0">0,00</xsl:when>
            <xsl:when test="string(number($num)) = 'NaN'"/>
            <xsl:otherwise>
                <xsl:value-of select="format-number($num,'# ###,00;-# ###,00','decformat')"/><!-- ,'decformat' -->
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <!-- d&#233;but du document -->
    <xsl:template match="/n:PES_Aller">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
            <head>
                <style type="text/css" media="all">
                    @page {
                        size: 29.7cm 21cm;
                        margin: 0.5 0.5 0.5 0.5;
                    }
                    body {
                        width: 26.7cm;
                        font-family: verdana, sans-serif;
                        font-size: 10px;
                        background-color: #FFFFFF;
                    }
                    div.divpage {
                        width: 28.7cm;
                        margin: 0 0 0 0;
                    }
                    table { border-collapse: collapse; }
                    table.entete {
                        margin: 0;
                        border-style: none;
                        border-width: 0px;
                        border-color: black;
                        width: 100%;
                        font-size: 14px;
                    }
                    anomalie { background-color: #FFFF66; }
                    tr { margin: 0; }
                    td {
                        margin: 0;
                        border-style: inset;
                        border-width: 1px;
                        border-color: black;
                        vertical-align: top;
                        line-height: 13px;
                    }
                    td.head1 {
                        width: 16cm;
                        border-style: none;
                    }
                    td.head2 {
                        width: 5cm;
                        text-align: center;
                        border-style: none;
                    }
                    td.colonne1 {
                        width: 6cm;
                    border-style: none;
                    }
                    td.colonne2 {
                        width: 15cm;
                        text-align: center;
                    border-style: none;
                    }
                    td.colonne3 {
                        width: 3.5cm;
                    border-style: none;
                    }
                    td.colonne4 {
                        width: 3cm;
                    border-style: none;
                    }
                    table.enteteTablePrincipale {
                        font-size: 10px;
                        text-align: center;
                        width: 100%;
                    }
                    table.inner {
                        font-size: 10px;
                        text-align: left;
                        width: 100%;
                    }
                    td.principaleCol1 {
                        width: 6.5cm;
                    }
                    td.principaleCol2 {
                        width: 2cm;
                    }
                    td.principaleCol3 {
                        width: 6.5cm;
                    }
                    td.principaleCol4 {
                        width: 1.7cm;
                    }
                    td.principaleCol5 {
                        width: 1.7cm;
                    }
                    td.principaleCol6 {
                        width: 1.6cm;
                    }
                    td.principaleCol7 {
                        width: 2.5cm;
                    }
                    td.principaleCol8 {
                        width: 2.5cm;
                    }
                    td.principaleCol9 {
                        width: 2.5cm;
                    }
                    table.totaux {
                        width: 100%;
                        font-size: 10px;
                        border-style: none;
                    }
                    td.sansBordure {
                        border-style: none;
                    }
                    td.mandatCol1 {
                        width: 5.5cm;
                        border-style: none none solid solid;
                    }
                    td.mandatCol2 {
                        width: 1cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol3 {
                        width: 4cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol3a {
                        width: 2cm;
                        text-align: left;
                    border-style: none none solid solid;
                    }
                    td.mandatCol3b {
                        width: 2cm;
                        text-align: right;
                    border-style: none none solid none;
                    }
                    td.mandatCol4 {
                        width: 6cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol4a {
                        width: 4cm;
                        text-align: left;
                    border-style: none none solid solid;
                    }
                    td.mandatCol4b {
                        width: 2cm;
                        text-align: right;
                        border-left-style: none;
                    border-style: none none solid none;
                    }
                    td.mandatCol5 {
                        width: 1.5cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol6 {
                        width: 1.5cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol7 {
                        width: 1.5cm;
                    border-style: none none solid solid;
                    }
                    td.mandatCol8 {
                        width: 6.5cm;
                    border-style: none solid solid solid;
                    }
                    td.mandatCol8a {
                        width: 4cm;
                        text-align: left;
                        border-style: none none solid solid; 
                    }
                    td.mandatCol8b {
                        width: 2.5cm;
                        text-align: right;
                        border-style: none solid solid none; 
                    }
                    table.footer {
                        margin: 0;
                        border-style: none;
                        width: 100%;
                        font-size: 12px;
                    }
                    td.totalLibelle {
                        width: 6cm;
                    }
                    td.totalValeur {
                        width: 2cm;
                        text-align: right;
                    }
                    td.noborder {
                        border-style: none;
                    }
                    td.right {
                        text-align: right;
                    }
                    noupper { border-top-style: none; }
                    :link { color: #0000EE; background: transparent }
                    :visited { color: #551A8B; background: transparent }
                    a:active { color: #0000EE; background: transparent }
                    a:link img, a:visited img { border-style: none }
                    .gras { font-weight: bold; }
                    .pj { font-size: 10px; font-weight: normal; }
                    li.pj { list-style-type: none; margin-left: -20px; }
                    .rouge { color: red; font-weight: bold; }
                </style>
                <title><xsl:choose><xsl:when test="$elementId='Bordereau'">Bordereau</xsl:when><xsl:otherwise>Mandat</xsl:otherwise></xsl:choose> de d&#233;pense</title>
            </head>
            <body>
                <!--div>param elementId = <xsl:value-of select="$elementId"/><br />param mandatId = <xsl:value-of select="$mandatId"/><br />param browser-destination = <xsl:value-of select="$browser-destination"/><br />AnoId = <xsl:value-of select="$anoId"></xsl:value-of><br />&lt;tags-ano&gt;<xsl:for-each select="$tags-ano/node">&lt;node id="<xsl:value-of select="./@id"/>"/&gt;</xsl:for-each>&lt;/tags-ano&gt;<br/>$primarykey=<xsl:value-of select="$primaryKey"/><br/>Bordereau/added:primary-key=<xsl:value-of select="$bordereau/added:primary-key"/></div-->
                <!--div class="divpage"-->
                    <!--a name="_top">ici haut</a-->
                <xsl:choose>
                <xsl:when test="$elementId='Bordereau'">
                <!-- pour un bordereau -->
                    <!-- table pour l'ent&#234;te -->
                    <table class="entete" cellspacing="0">
                        <tr>
                            <td class="head1">
                                <xsl:element name="codique">
                                    <xsl:variable name="idPostNodeId" select="./n:EnTetePES/n:IdPost/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $idPostNodeId]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:EnTetePES/n:IdPost/@V"/>
                                </xsl:element>
                                &nbsp;<xsl:value-of select="./n:EnTetePES/n:LibellePoste/@V"/>
                            </td>
                            <td class="head2">
                                <!-- img src="xemelios:/resource?helios.png" alt="*logo helios*"/ -->
                            </td>
                            <td class="colonne3">Exercice</td>
                            <xsl:element name="td">
                                <xsl:attribute name="class">colonne4</xsl:attribute>
                                <xsl:variable name="currentNodeId" select="$bordereau/n:BlocBordereau/n:Exer/@ano:node-id"/>
                                <xsl:if test="count($tags-ano/node[@id = $currentNodeId]) &gt; 0">
                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="$bordereau/n:BlocBordereau/n:Exer/@V"/>
                            </xsl:element>
                        </tr>
                    </table>
                    <p><br/></p>
                    <!-- table pour le titre du bordereau -->
                    <table class="entete" cellspacing="0">
                        <tr>
                            <td class="colonne1">                            
                                <xsl:element name="codeCol">
                                    <xsl:variable name="codColNodeId" select="./n:EnTetePES/n:CodCol/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $codColNodeId]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:EnTetePES/n:CodCol/@V"/>
                                </xsl:element>
                                
                                <xsl:element name="codeBudget">
                                    <xsl:variable name="codBudNodeId" select="./n:EnTetePES/n:CodBud/@ano:node-id"/>                                  
                                    <xsl:if test="count($tags-ano/node[@id = $codBudNodeId]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:EnTetePES/n:CodBud/@V"/>
                                </xsl:element>
                                
                                &nbsp;<xsl:value-of select="./n:EnTetePES/n:LibelleColBud/@V"/><br/>
                                
                                <xsl:element name="siret">
                                    <xsl:variable name="idCollNodeId" select="./n:EnTetePES/n:IdColl/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $idCollNodeId]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:EnTetePES/n:IdColl/@V"/>
                                </xsl:element>
                            </td>
                                                                                             
                            <td class="colonne2">Bordereau 
                                <xsl:element name="span">
                                  <xsl:variable name="nodeIdTypBord" select="$bordereau/n:BlocBordereau/n:TypBord/@ano:node-id"/>
                                  <xsl:if test="count($tags-ano/node[@id = $nodeIdTypBord]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                  <xsl:call-template name="typeBordereauLibelle" ><xsl:with-param name="typeBord" select="$bordereau/n:BlocBordereau/n:TypBord/@V"/></xsl:call-template>
                                </xsl:element><br/>
                                <xsl:value-of select="$bordereau/n:BlocBordereau/n:NbrPce/@V"/>&nbsp;<xsl:choose>
                                    <xsl:when test="$bordereau/n:BlocBordereau/n:NbrPce/@V = 1">Mandat</xsl:when>
                                    <xsl:otherwise>Mandats</xsl:otherwise>
                                </xsl:choose>
                            </td>
                            <td class="colonne3">Bordereau</td>
                            <xsl:element name="td">
                                <xsl:attribute name="class">colonne4</xsl:attribute>
                                <xsl:variable name="nodeIdBordereau" select="$bordereau/n:BlocBordereau/n:IdBord/ano:node-id"/>
                                <xsl:if test="count($tags-ano/node[@id = $nodeIdBordereau]) &gt; 0">
                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                </xsl:if>
                            <xsl:value-of select="$bordereau/n:BlocBordereau/n:IdBord/@V"/>
                            </xsl:element>
                        </tr>
                        <tr><td colspan="2" class="colonne1"></td><td class="colonne3">Date d'&#233;mission</td><td class="colonne4"><xsl:call-template name="slash-date">
                            <xsl:with-param name="datebrute" select="$bordereau/n:BlocBordereau/n:DteBordEm/@V"></xsl:with-param>
                        </xsl:call-template></td></tr>
                    </table>
                    <p><br/></p>
                    <!-- entete de la table principale -->
                    <table class="enteteTablePrincipale" cellspacing="0">
                        <tr>
                            <td class="principaleCol1" style="border-bottom-style: none;">Nom et adresse du cr&#233;ancier</td>
                            <td class="principaleCol2" style="border-bottom-style: none;">Mandat</td>
                            <td class="principaleCol3" style="border-bottom-style: none;">Objet mandat</td>
                            <td colspan="3" style="text-align:center;border-bottom-style: none;border-right-style: none;">Imputation</td>
                            <td class="principaleCol7" style="border-bottom-style: none;">Somme</td>
                            <td class="principaleCol8" style="border-bottom-style: none;">Somme</td>
                            <td class="principaleCol9" style="border-bottom-style: none;">Somme</td>
                        </tr>
                        <tr>
                            <td class="principaleCol1" style="border-top-style: none;">&nbsp;</td>
                            <td class="principaleCol2" style="border-top-style: none;">&nbsp;</td>
                            <td class="principaleCol3" style="border-top-style: none;">&nbsp;</td>
                            <td class="principaleCol4">Nature</td>
                            <td class="principaleCol5">Fonction</td>
                            <td class="principaleCol6">Op&#233;ration</td>
                            <td class="principaleCol7" style="border-top-style: none;">HT</td>
                            <td class="principaleCol8" style="border-top-style: none;">TVA</td>
                            <td class="principaleCol9" style="border-top-style: none;">TTC</td>
                        </tr>
                        <!-- contenu de la table principale -->
                        <xsl:for-each select="$bordereau/n:Piece" >
                            <xsl:element name="tr">
                                <!--xsl:if test="$tags-ano/node[@id = ./@ano:node-id]"-->
                                <xsl:variable name="currentNodeId" select="./n:BlocPiece/@ano:node-id"/>
                                <!--xsl:attribute name="node-id"><xsl:value-of select="$currentNodeId"/></xsl:attribute-->
                                <xsl:if test="count($tags-ano/node[@id = $currentNodeId]) &gt; 0">
                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                </xsl:if>
                                <td class="principaleCol1">
                                    <xsl:choose>
                                        <xsl:when test="count(distinct-values(n:LigneDePiece/n:Tiers/n:InfoTiers/@added:key)) = 1">
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Nom/@V) &gt; 0"><span><xsl:variable name="nodeIdNom" select="./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Nom/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdNom]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Nom/@V"/></span>&nbsp;</xsl:if>
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Prenom/@V) &gt; 0"><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Prenom/@V"/>&nbsp;</xsl:if>
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:ComplNom/@V) &gt; 0"><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:ComplNom/@V"/></xsl:if>
                                            <xsl:if test="(string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:ComplNom/@V)+string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Prenom/@V)+string-length(./n:LigneDePiece[1]/n:Tiers/n:InfoTiers/n:Nom/@V)) &gt; 0"><br/></xsl:if>
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Adr1/@V) &gt; 0"><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Adr1/@V"/><br/></xsl:if>
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Adr2/@V) &gt; 0"><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Adr2/@V"/><br/></xsl:if>
                                            <xsl:if test="string-length(./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:CP/@V)+string-length(./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Ville/@V) &gt; 0"><xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:CP/@V"/>&nbsp;<xsl:value-of select="./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:Ville/@V"/></xsl:if>
                                            <xsl:if test="./n:LigneDePiece/n:Tiers/n:Adresse/n:CodPays"> - <xsl:call-template name="codePaysINSEE">
                                                <xsl:with-param name="codePays" select="./n:LigneDePiece[1]/n:Tiers/n:Adresse/n:CodPays/@V"></xsl:with-param>
                                            </xsl:call-template></xsl:if>
                                        </xsl:when>
                                        <xsl:otherwise>DIVERS CREANCIERS</xsl:otherwise>
                                    </xsl:choose>
                                </td>
                                <xsl:element name="td">
                                    <xsl:attribute name="class">principaleCol2</xsl:attribute>
                                    <xsl:variable name="nodeIdPiece" select="./n:BlocPiece/n:InfoPce/n:IdPce/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $nodeIdPiece]) &gt; 0">
                                        <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                    </xsl:if>
                                    <xsl:if test="$browser-destination = 'internal'"><xsl:element name="a"><xsl:attribute name="href">xemelios:/query?docId=PES_Aller&amp;etatId=PES_DepenseAller&amp;elementId=BordereauDepense&amp;collectivite=<xsl:value-of select="../../../n:EnTetePES/n:IdColl/@V"/>&amp;budget=<xsl:value-of select="../../../n:EnTetePES/n:CodBud/@V"/>&amp;path=[@added:primary-key='<xsl:value-of select="../@added:primary-key"/>']&amp;xsl:param=(mandatId,<xsl:value-of select="n:BlocPiece/n:InfoPce/n:IdPce/@V"/>)</xsl:attribute><xsl:value-of select="./n:BlocPiece/n:InfoPce/n:IdPce/@V"/></xsl:element></xsl:if>
                                    <xsl:if test="$browser-destination = 'external'"><xsl:value-of select="./n:BlocPiece/n:InfoPce/n:IdPce/@V"/></xsl:if>
                                </xsl:element>
                                <td class="principaleCol3">
                                    <xsl:value-of select="./n:BlocPiece/n:InfoPce/n:Obj/@V"/><br/>
                                    <xsl:element name="span">
                                        <xsl:variable name="nodeIdTypPce" select="./n:BlocPiece/n:InfoPce/n:TypPce/@ano:node-id"/>
                                        <xsl:if test="count($tags-ano/node[@id = $nodeIdTypPce]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:call-template name="typePieceLibelle" >
                                        <xsl:with-param name="typePiece" select="./n:BlocPiece/n:InfoPce/n:TypPce/@V" />
                                    </xsl:call-template></xsl:element><br/>
                                    <xsl:element name="span">
                                        <xsl:variable name="nodeIdNatPce" select="./n:BlocPiece/n:InfoPce/n:NatPce/@ano:node-id"/>
                                        <xsl:if test="count($tags-ano/node[@id = $nodeIdNatPce]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:call-template name="naturePieceLibelle" >
                                        <xsl:with-param name="naturePiece" select="./n:BlocPiece/n:InfoPce/n:NatPce/@V" />
                                    </xsl:call-template></xsl:element><br/>
                                </td>

                                <!-- boucler dans les colonnes suivantes quand il y a plusieurs cr&#233;anciers -->
                                <td class="principaleCol4">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <span><xsl:variable name="nodeIdNature" select="current-group()/n:Nature/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdNature]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="current-group()[1]/n:Nature/@V"/></span><br/>
                                    </xsl:for-each-group>
                                </td>
                                <td class="principaleCol5">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <xsl:value-of select="current-group()[1]/n:Fonction/@V"/><br/>
                                    </xsl:for-each-group>
                                </td>
                                <td class="principaleCol6">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <xsl:value-of select="current-group()[1]/n:Operation/@V"/><br/>
                                    </xsl:for-each-group>
                                </td>
                                <td class="principaleCol7">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <xsl:call-template name="number"><xsl:with-param name="num" select="sum(current-group()/n:MtHT/@V)"/></xsl:call-template><br/>
                                    </xsl:for-each-group>
                                </td>
                                <td class="principaleCol8">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <xsl:call-template name="number"><xsl:with-param name="num" select="sum(current-group()/n:MtTVA/@V)"/></xsl:call-template><br/>
                                    </xsl:for-each-group>
                                </td>
                                <td class="principaleCol9">
                                    <xsl:for-each-group select="./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce" group-by="@added:imputation">
                                        <xsl:call-template name="number"><xsl:with-param name="num" select="sum(current-group()/n:MtHT/@V)+sum(current-group()/n:MtTVA/@V)"/></xsl:call-template><br/>
                                    </xsl:for-each-group>
                                </td>
                            </xsl:element>
                        </xsl:for-each>
                    </table>
                    <p><br/></p>
                    <!-- table pour les totaux -->
                    <xsl:variable name="totalTVABordereau">
                        <xsl:choose>
                            <xsl:when test="$bordereau/n:BlocBordereau/n:MtBordTVA/@V &gt; 0">
                                <xsl:value-of select="$bordereau/n:BlocBordereau/n:MtBordTVA/@V"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="0"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="totalTTCBordereau" select="$bordereau/n:BlocBordereau/n:MtBordHT/@V + $totalTVABordereau"/>
                    
                    <xsl:variable name="minMandat">
                        <xsl:for-each select="$bordereau/n:Piece/n:BlocPiece/n:InfoPce/n:IdPce/@V">
                            <xsl:sort data-type="number" order="ascending"/>
                            <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
                        </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="maxMandat">
                        <xsl:for-each select="$bordereau/n:Piece/n:BlocPiece/n:InfoPce/n:IdPce/@V">
                            <xsl:sort data-type="number" order="descending"/>
                            <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
                        </xsl:for-each>
                    </xsl:variable>
                    <table class="totaux" cellspacing="0">
<!-- Mise en surbrillance des montant nulls ou negatifs. -->
                        <xsl:variable name="nodeHT" select="$bordereau/n:BlocBordereau/n:MtBordHT/@ano:node-id"/>
                        <xsl:variable name="nodeTVA" select="$bordereau/n:BlocBordereau/n:MtBordTVA/@ano:node-id"/>
                        <xsl:variable name="isNodeHTError" select="count($tags-ano/node[@id = $nodeHT]) &gt; 0"/>
                        <xsl:variable name="isNodeTVAError" select="count($tags-ano/node[@id = $nodeTVA]) &gt; 0"/>
                        <xsl:variable name="rowspan">
                            <xsl:choose>
                                <xsl:when test="$isNodeHTError">5</xsl:when>
                                <xsl:otherwise>4</xsl:otherwise>
                            </xsl:choose>
                        </xsl:variable>
                        <tr>
                            <td class="noborder" rowspan="{$rowspan}">Arr&#234;t&#233; le pr&#233;sent bordereau &#224; la somme de <xsl:call-template name="number"><xsl:with-param name="num" select="$totalTTCBordereau"></xsl:with-param></xsl:call-template> euros.<br/>
                                <xsl:choose>
                                    <xsl:when test="$minMandat = $maxMandat">Comprenant le mandat n&#176;<xsl:value-of select="$minMandat"/></xsl:when>
                                    <xsl:otherwise>Comprenant les mandats n&#176;<xsl:value-of select="$minMandat"/> &#224; <xsl:value-of select="$maxMandat"/></xsl:otherwise>
                                </xsl:choose>
                                <!-- MANQUE les donn&#233;es sur l'ordonnateur. YLA - 2007/02/15 -->
                                <xsl:variable name="isSigned" select="exists($bordereau/ds:Signature)"/>
                                <xsl:variable name="isSignedGlobal" select="exists(PES/ds:Signature)"/>
                                <xsl:if test="count($bordereau/ds:Signature/ds:KeyInfo/ds:X509Data/ds:X509Certificate) &gt; 1">
                                    <xsl:message>Un seul certificat est accépté</xsl:message>
                                </xsl:if>
                                <xsl:variable name="signature" select="$bordereau/ds:Signature/ds:KeyInfo/ds:X509Data"/><!-- ds:X509Certificate/text()-->
                                <xsl:variable name="nomSignataire">
                                    <xsl:choose>
                                        <xsl:when test="$isSigned"><xsl:for-each select="$signature/ds:X509Certificate"><xsl:value-of select="xem:extractCN(./text())"/><xsl:if test="not(position() = last())"> / </xsl:if></xsl:for-each></xsl:when>
                                        <xsl:otherwise>[NomSignataire]</xsl:otherwise>
                                    </xsl:choose>
                                </xsl:variable>
                                <xsl:variable name="role">
                                    <xsl:choose>
                                        <xsl:when test="$isSigned and $bordereau/ds:Signature/ds:Object/*[local-name()='QualifyingProperties']/*[local-name()='SignedProperties']/*[local-name()='SignedSignatureProperties']/*[local-name()='SignerRole']"><xsl:value-of select="$bordereau/ds:Signature/ds:Object/*[local-name()='QualifyingProperties']/*[local-name()='SignedProperties']/*[local-name()='SignedSignatureProperties']/*[local-name()='SignerRole']/*[local-name()='ClaimedRoles']/*[local-name()='ClaimedRole'][1]/text()"></xsl:value-of></xsl:when>
                                        <xsl:otherwise>[Role]</xsl:otherwise>
                                    </xsl:choose>
                                </xsl:variable>
                                <xsl:variable name="email">
                                    <xsl:choose>
                                        <xsl:when test="$isSigned"><xsl:for-each select="$signature/ds:X509Certificate"><xsl:value-of select="xem:extractEMail(./text())"/><xsl:if test="not(position() = last())"> / </xsl:if></xsl:for-each></xsl:when>
                                        <xsl:otherwise>[AdresseEMail]</xsl:otherwise>
                                    </xsl:choose>
                                </xsl:variable>
                                <br/>
                                <xsl:choose>
                                    <xsl:when test="$isSigned"><br/><span class="rouge">Ce bordereau est sign&#233;. Ces &#233;l&#233;ments sont d&#233;duits du flux avec pr&#233;sence de signature &#233;lectronique.</span></xsl:when>
                                    <xsl:otherwise><br/><emp><xsl:value-of select="$bordereau/comment()"/></emp><span class="rouge">Ces &#233;l&#233;ments sont d&#233;duits du flux mais absence de signature &#233;lectronique.</span></xsl:otherwise>
                                </xsl:choose>

                                <br/><br/>L'ordonnateur <xsl:value-of select="$nomSignataire"/><br/>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<xsl:value-of select="$role"/><br/>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:LibelleColBud/@V"/><br/>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<xsl:value-of select="$email"/><br/>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T&#233;l : [NumeroTelephone]<br/>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;le <xsl:call-template name="slash-date"><xsl:with-param name="datebrute" select="$bordereau/n:BlocBordereau/n:DteBordEm/@V"/></xsl:call-template>
                            </td>
                            <td class="totalLibelle" style="border-style: solid none none solid;">Total&nbsp;du&nbsp;pr&#233;sent&nbsp;bordereau</td>
                            <td class="totalValeur" style="border-style: solid solid none none;"><xsl:call-template name="number"><xsl:with-param name="num" select="$totalTTCBordereau"/></xsl:call-template></td>
                        </tr>
                        <xsl:if test="$isNodeHTError">
                            <tr style="background-color: #FFFF66;">
                                <td class="totalLibelle" style="border-style: none none none solid;">[MtBordHT]</td>
                                <td class="totalValeur" style="border-style: none solid none none;"><xsl:value-of select="$bordereau/n:BlocBordereau/n:MtBordHT/@V"/></td>
                            </tr>
                        </xsl:if>
                        <xsl:element name="tr">
                            <xsl:if test="$isNodeTVAError">
                                <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                            </xsl:if>
                            <!--td>&nbsp;</td-->
                            <td class="totalLibelle" style="border-style: none none none solid;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dont TVA</td>
                            <td class="totalValeur" style="border-style: none solid none none;"><xsl:call-template name="number"><xsl:with-param name="num" select="$totalTVABordereau"/></xsl:call-template>&nbsp;</td>
                        </xsl:element>
                        <tr>
                            <!--td>&nbsp;</td-->
                            <td class="totalLibelle" style="border-style: none none none solid;">Total&nbsp;g&#233;n&#233;ral&nbsp;au&nbsp;pr&#233;c&#233;dent&nbsp;bordereau</td>
                            <td class="totalValeur" style="border-style: none solid none none;"><xsl:call-template name="number"><xsl:with-param name="num" select="$bordereau/n:BlocBordereau/n:MtCumulAnnuel/@V - $totalTTCBordereau"></xsl:with-param></xsl:call-template></td>
                        </tr>
                        <tr>
                            <!--td>&nbsp;</td-->
                            <td class="totalLibelle" style="border-style: none none solid solid;">Cumul&nbsp;annuel</td>
                            <td class="totalValeur" style="border-style: none solid solid none;"><xsl:call-template name="number"><xsl:with-param name="num" select="$bordereau/n:BlocBordereau/n:MtCumulAnnuel/@V"></xsl:with-param></xsl:call-template></td>
                        </tr>
                    </table>
                    <p><br/></p>
                    <xsl:if test="$bordereau/ano:Anomalie">
                        <hr />
                        <xsl:for-each select="$bordereau/ano:Anomalie">
                            <xsl:element name="div">
                                <xsl:if test="$anoId = ./@ano:anoId">
                                    <xsl:attribute name="style">background-color: #FFFF66</xsl:attribute>
                                </xsl:if>
                                <!--a><xsl:attribute name="name">AnoId_<xsl:value-of select="./@ano:anoId"/></xsl:attribute> </a-->
                                <h3>
                                    <xsl:element name="a">
                                        <xsl:attribute name="name">AnoId_<xsl:value-of select="./@ano:anoId"/></xsl:attribute>
                                        <xsl:attribute name="href">xemelios:/query?docId=PES_Aller&amp;etatId=PES_DepenseAller&amp;elementId=BordereauDepense&amp;collectivite=<xsl:value-of select="../../../n:EnTetePES/n:IdColl/@V"/>&amp;budget=<xsl:value-of select="../../../n:EnTetePES/n:CodBud/@V"/>&amp;path=[@added:primary-key='<xsl:value-of select="../@added:primary-key"/>']&amp;xsl:param=(elementId,Bordereau)&amp;xsl:param=(anoId,<xsl:value-of select="./@ano:anoId"/>)</xsl:attribute>
                                        Anomalie <!--xsl:value-of select="./@ano:anoId"/-->
                                    </xsl:element>
                                </h3>
                            <p><span class="gras">Contr&#244;le : </span><xsl:value-of select="./@ano:ctrlId"/></p>
                            <p><span class="gras">R&#232;gle fonctionnelle : </span><xsl:value-of select="./ano:ctrlRegleFonct/text()" disable-output-escaping="yes"/></p>
                            <p><span class="gras">Message : </span><xsl:value-of select="./ano:message/text()" disable-output-escaping="yes"/></p>
                            <!--p><span class="gras">Noeuds : </span><xsl:for-each select="ano:node"><xsl:value-of select="./@ano:id"/>, </xsl:for-each></p-->
                            </xsl:element>
                        </xsl:for-each>
                        <hr />
                    </xsl:if>
                </xsl:when>

                <xsl:otherwise>
                <!-- Cas d'un mandat -->
                    <!-- table pour l'ent&#234;te -->
                    <table class="entete" cellspacing="0">
                        <tr>
                            <td class="head1">
                                <xsl:value-of select="./n:EnTetePES/n:IdPost/@V"/>&nbsp;<xsl:value-of select="./n:EnTetePES/n:LibellePoste/@V"/>
                            </td>
                            <td class="head2">
                                <!-- img src="xemelios:/resource?helios.png" alt="*logo helios*"/ -->
                            </td>
                            <td class="colonne3">Exercice</td>
                            <td class="colonne4"><xsl:value-of select="$bordereau/n:BlocBordereau/n:Exer/@V"/>
                            </td>
                        </tr>
                    </table>
                    <p><br/></p>
                    <xsl:for-each select="$bordereau/n:Piece[number(n:BlocPiece/n:InfoPce/n:IdPce/@V) = number($mandatId)]">
                    <!--xsl:if test="./@added:generated-id = $nodeId"-->
                        <!-- on calcule les totaux HT et TTC -->
                        <xsl:variable name="totalHT">
                            <xsl:value-of select="sum(./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce/n:MtHT/@V)"/>
                        </xsl:variable>
                        <xsl:variable name="totalTTC">
                            <xsl:value-of select="sum(./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce/n:MtHT/@V)+sum(./n:LigneDePiece/n:BlocLignePiece/n:InfoLignePce/n:MtTVA/@V)"/>
                        </xsl:variable>
                        <!-- table pour le titre du mandat -->
                        <table class="entete" cellspacing="0">
                            <tr>
                                <td class="colonne1">
                                    <xsl:value-of select="../../../n:EnTetePES/n:CodCol/@V"/><xsl:value-of select="../../../n:EnTetePES/n:CodBud/@V"/>&nbsp;
                                    <xsl:value-of select="../../../n:EnTetePES/n:LibelleColBud/@V"/><br/>
                                    <xsl:value-of select="../../../n:EnTetePES/n:IdColl/@V"/>
                                    <!-- MANQUE ServiceOrdonnateur : on n'a pas les donn&#233;es -->
                                    <!-- MANQUE FinJur : on n'a pas les donn&#233;es -->
                                </td>
                                <td class="colonne2" style="font-weight:bold">
                                    
                                    <xsl:call-template name="typePieceLibelle" >
                                        <xsl:with-param name="typePiece" select="./n:BlocPiece/n:InfoPce/n:TypPce/@V" />
                                    </xsl:call-template><br/>
                                    <xsl:call-template name="naturePieceLibelle" >
                                        <xsl:with-param name="naturePiece" select="./n:BlocPiece/n:InfoPce/n:NatPce/@V" />
                                    </xsl:call-template><br/>
                                    <xsl:value-of select="./n:BlocPiece/n:InfoPce/n:Obj/@V"/>
                                    <xsl:value-of select="./n:BlocPiece/n:InfoPce/n:PJ/@V"/><br/>
                                    <!-- On calcule le nombre de PJ pour chaque type de support -->
                                    <xsl:variable name="nbPJPieceElectro">
                                        <xsl:value-of select="count(./n:BlocPiece/n:InfoPce/n:PJRef/n:Support[@V=01])"/>
                                    </xsl:variable>
                                    <xsl:variable name="nbPJPiecePapier">
                                        <xsl:value-of select="count(./n:BlocPiece/n:InfoPce/n:PJRef/n:Support[@V=02])"/>
                                    </xsl:variable>
                                    <xsl:variable name="nbPJPieceCDROM">
                                        <xsl:value-of select="count(./n:BlocPiece/n:InfoPce/n:PJRef/n:Support[@V=03])"/>
                                    </xsl:variable>
                                    <div style="font-size: 10px; text-align: left; margin-left: 5cm;">
                                        <!--xsl:choose>
                                            <xsl:when test="$nbPJPieceElectro + $nbPJPiecePapier + $nbPJPieceCDROM = 0">
                                                Non Justifi&#233;
                                            </xsl:when>
                                            <xsl:otherwise-->
                                    Justifi&#233; par <xsl:value-of select="$nbPJPieceElectro + $nbPJPiecePapier + $nbPJPieceCDROM"/>
                                    document(s) dont :<ul style="font-size:10px; margin-top: 0px;">
                                        <li><xsl:value-of select="$nbPJPieceElectro"/> document(s) en ligne<xsl:if test="$nbPJPieceElectro &gt; 0">
                                            <ul class="pj">
                                                <xsl:for-each select="./n:BlocPiece/n:InfoPce/n:PJRef[n:Support/@V=01]">
                                                    <li class="pj">
                                                        <xsl:choose>
                                                            <xsl:when test="true()">
                                                                <a>
                                                                    <xsl:attribute name="href">xemelios:/attachment?pjId=<xsl:value-of select="./n:IdUnique/@V"/>&amp;collectivite=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:IdColl/@V"/></xsl:attribute>
                                                                    <xsl:value-of select="./n:IdUnique/@V"/>
                                                                    <xsl:choose>
                                                                        <xsl:when test="string-length(./n:NomPJ/@V) &gt; 0">&#160;(<xsl:value-of select="./n:NomPJ/@V"/>)</xsl:when>
                                                                    </xsl:choose>
                                                                </a>
                                                            </xsl:when>
                                                            <xsl:otherwise><xsl:value-of select="./n:IdUnique/@V"/>
                                                                <xsl:choose>
                                                                    <xsl:when test="string-length(./n:NomPJ/@V) &gt; 0">&#160;(<xsl:value-of select="./n:NomPJ/@V"/>)</xsl:when>
                                                                </xsl:choose></xsl:otherwise>
                                                        </xsl:choose>
                                                    </li>
                                                </xsl:for-each>
                                            </ul>
                                        </xsl:if></li>
                                        <li><xsl:value-of select="$nbPJPiecePapier"/> document(s) papier<xsl:if test="$nbPJPiecePapier &gt; 0">
                                            <ul class="pj">
                                                <xsl:for-each select="./n:BlocPiece/n:InfoPce/n:PJRef[n:Support/@V=02]">
                                                    <li class="pj">
                                                        <xsl:choose>
                                                            <xsl:when test="string-length(./n:NomPJ/@V) &gt; 0"><xsl:value-of select="./n:NomPJ/@V"/></xsl:when>
                                                        </xsl:choose><xsl:value-of select="./n:IdUnique/@V"/>
                                                    </li>
                                                </xsl:for-each>
                                            </ul>
                                        </xsl:if></li>
                                        <li><xsl:value-of select="$nbPJPieceCDROM"/> document(s) sur CDROM<xsl:if test="$nbPJPieceCDROM &gt; 0">
                                            <ul class="pj">
                                                <xsl:for-each select="./n:BlocPiece/n:InfoPce/n:PJRef[n:Support/@V=03]">
                                                    <li class="pj"><xsl:choose>
                                                        <xsl:when test="string-length(./n:NomPJ/@V) &gt; 0"><xsl:value-of select="./n:NomPJ/@V"/></xsl:when>
                                                    </xsl:choose><xsl:value-of select="./n:IdUnique/@V"/></li>
                                                </xsl:for-each>
                                            </ul>
                                        </xsl:if></li>
                                    </ul>
                                            <!--/xsl:otherwise>
                                        </xsl:choose-->
                                    </div>
                                </td>
                                <td class="colonne3" colspan="2">
                                    <table class="entete" cellspacing="0" width="100%">
                                        <tr><td class="noborder">Mandat</td><td class="noborder"><xsl:value-of select="./n:BlocPiece/n:InfoPce/n:IdPce/@V"/></td></tr>
                                        <tr><td class="noborder">Bordereau</td><td class="noborder"><xsl:choose>
                                            <xsl:when test="$browser-destination = 'internal'"><xsl:element name="a"><xsl:attribute name="href">xemelios:/query?docId=PES_Aller&amp;etatId=PES_DepenseAller&amp;elementId=BordereauDepense&amp;collectivite=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:IdColl/@V"/>&amp;budget=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:CodBud/@V"/>&amp;path=[@added:primary-key='<xsl:value-of select="../@added:primary-key"/>']&amp;xsl:param=(elementId,Bordereau)</xsl:attribute><xsl:value-of select="../n:BlocBordereau/n:IdBord/@V"/></xsl:element></xsl:when>
                                            <xsl:otherwise><xsl:value-of select="../n:BlocBordereau/n:IdBord/@V"/></xsl:otherwise>
                                        </xsl:choose></td></tr>
                                        <tr><td class="noborder">Date d'&#233;mission</td><td class="noborder"><xsl:call-template name="slash-date">
                                            <xsl:with-param name="datebrute" select="../n:BlocBordereau/n:DteBordEm/@V"></xsl:with-param>
                                        </xsl:call-template></td></tr>
                                    </table><br/></td>
                            </tr>
                        </table>
                        <p><br/></p>
                        <!-- entete de la table principale -->
                        <table class="enteteTablePrincipale" cellspacing="0">
                            <tr>
                                <td class="mandatCol1" rowspan="2" style="border-style: solid none solid solid;">Cr&#233;ancier</td>
                                <td class="mandatCol2" rowspan="2" style="border-style: solid none solid solid;">Ligne</td>
                                <td class="mandatCol3" rowspan="2" style="border-style: solid none solid solid;">Pi&#232;ce(s) de rattachement</td>
                                <td class="mandatCol4" rowspan="2" style="border-style: solid none solid solid;">Description</td>
                                <td colspan="3" style="text-align:center; border-bottom-style: solid;border-right-style: none;">Imputation</td>
                                <td class="mandatCol8" rowspan="2" style="border-style: solid solid solid solid;">Montant/D&#233;lais</td>
                            </tr>
                            <tr>
                                <!--td class="mandatCol1">&nbsp;</td>
                                <td class="mandatCol2">&nbsp;</td>
                                <td class="mandatCol3" colspan="2">&nbsp;</td>
                                <td class="mandatCol4" colspan="2">&nbsp;</td-->
                                <td class="mandatCol5" style="border-top-style: none;">Nature</td>
                                <td class="mandatCol6" style="border-top-style: none;">Fonction</td>
                                <td class="mandatCol7" style="border-top-style: none;">Op&#233;ration</td>
                                <!--td class="mandatCol8" colspan="2">&nbsp;</td-->
                            </tr>
                            <!-- contenu de la table principale -->
                            <xsl:for-each select="./n:LigneDePiece">
                                <xsl:sort select="n:BlocLignePiece/n:InfoLignePce/n:IdLigne/@V" data-type="number"></xsl:sort>
                                <xsl:variable name="nodeInfoLignePiece" select="./n:BlocLignePiece/n:InfoLignePce/@ano:node-id"/>
                                <xsl:variable name="isNodeInfoLignePieceError" select="count($tags-ano/node[id = $nodeInfoLignePiece]) &gt; 0"/>
                                <xsl:element name="tr">
                                    <xsl:attribute name="style">text-align: left;<xsl:if test="$isNodeInfoLignePieceError"> background-color: #FFFF66;</xsl:if></xsl:attribute>
                                <td class="mandatCol1">
                                    <span>
                                        <xsl:variable name="nodeIdNatIdTiers" select="./n:Tiers/n:InfoTiers/n:NatIdTiers/@ano:node-id"/>
                                        <xsl:variable name="nodeIdIdTiers" select="./n:Tiers/n:InfoTiers/n:IdTiers/@ano:node-id"/>
                                        <xsl:if test="(count($tags-ano/node[@id = $nodeIdNatIdTiers]) &gt; 0) or (count($tags-ano/node[@id = $nodeIdIdTiers]) &gt; 0)"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:call-template name="typeTiersNational" >
                                        <xsl:with-param name="typeTiers" select="./n:Tiers/n:InfoTiers/n:NatIdTiers/@V" />
                                    </xsl:call-template><xsl:if test="string-length(./n:Tiers[1]/n:InfoTiers/n:IdTiers/@V) &gt; 0">&nbsp;:&nbsp;</xsl:if><xsl:value-of select="./n:Tiers/n:InfoTiers/n:IdTiers/@V"/></span><br/>
                                    <span>
                                        <xsl:variable name="nodeIdCatTiers" select="./n:Tiers/n:InfoTiers/n:CatTiers/@ano:node-id"/>
                                        <xsl:if test="count($tags-ano/node[@id = $nodeIdCatTiers]) &gt; 0">
                                            <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                        </xsl:if>
                                    <xsl:call-template name="categorieTiers" >
                                        <xsl:with-param name="catTiers" select="./n:Tiers/n:InfoTiers/n:CatTiers/@V" />
                                    </xsl:call-template></span><br/>
                                    <span>
                                        <xsl:variable name="nodeIdCatJur" select="./n:Tiers/n:InfoTiers/n:NatJur/@ano:node-id"/>
                                        <xsl:if test="count($tags-ano/node[@id = $nodeIdCatJur]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:call-template name="natureJuridiqueTiers" >
                                        <xsl:with-param name="natJur" select="./n:Tiers/n:InfoTiers/n:NatJur/@V" />
                                    </xsl:call-template></span><br/>
                                    <xsl:if test="string-length(./n:Tiers/n:InfoTiers/n:Civilite/@V) &gt; 0"><xsl:value-of select="./n:Tiers/n:InfoTiers/n:Civilite/@V"/>&nbsp;</xsl:if>
                                    <xsl:variable name="currentNodeId" select="./n:Tiers/n:InfoTiers/n:Nom/@ano:node-id"/>
                                    <xsl:if test="string-length(./n:Tiers/n:InfoTiers/n:Nom/@V)">
                                        <xsl:choose>
                                            <xsl:when test="count($tags-ano/node[@id = $currentNodeId]) &gt; 0">
                                                <xsl:element name="span">
                                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                                    <xsl:value-of select="./n:Tiers/n:InfoTiers/n:Nom/@V"/></xsl:element>&nbsp;
                                            </xsl:when>
                                            <xsl:otherwise><xsl:value-of select="./n:Tiers/n:InfoTiers/n:Nom/@V"/>&nbsp;</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:if>
                                    <xsl:if test="string-length(./n:Tiers/n:InfoTiers/n:Prenom/@V) &gt; 0"><xsl:value-of select="./n:Tiers/n:InfoTiers/n:Prenom/@V"/>&nbsp;</xsl:if>
                                    <xsl:if test="string-length(./n:Tiers/n:InfoTiers/n:ComplNom/@V) &gt; 0"><xsl:value-of select="./n:Tiers/n:InfoTiers/n:ComplNom/@V"/>&nbsp;</xsl:if>
                                    <xsl:if test="(string-length(./n:Tiers/n:InfoTiers/n:Civilite/@V)+string-length(./n:Tiers/n:InfoTiers/n:Nom/@V)+string-length(./n:Tiers/n:InfoTiers/n:Prenom/@V)+string-length(./n:Tiers/n:InfoTiers/n:ComplNom/@V)) &gt; 0"><br/></xsl:if>
                                    <!--xsl:variable name="typeAdresseToDisplay">
                                        <xsl:call-template name="typeAdresse" >
                                            <xsl:with-param name="codeType" select="./n:Tiers/n:Adresse/n:TypAdr/@V" />
                                        </xsl:call-template>
                                    </xsl:variable>
                                    <xsl:if test="string-length($typeAdresseToDisplay) &gt; 0">
                                        <xsl:value-of select="$typeAdresseToDisplay"/><br/>
                                    </xsl:if-->
                                    <xsl:if test="string-length(./n:Tiers/n:Adresse/n:Adr1/@V) &gt; 0"><xsl:value-of select="./n:Tiers/n:Adresse/n:Adr1/@V"/><br/></xsl:if>
                                    <xsl:if test="string-length(./n:Tiers/n:Adresse/n:Adr2/@V) &gt; 0"><xsl:value-of select="./n:Tiers/n:Adresse/n:Adr2/@V"/><br/></xsl:if>
                                    <!--xsl:value-of select="./n:Tiers/n:Adresse/n:CP/@V"/-->
                                    <xsl:variable name="NodeIdCP" select="./n:Tiers/n:Adresse/n:CP/@ano:node-id"/>
                                    <xsl:if test="string-length(./n:Tiers/n:Adresse/n:CP/@V)">
                                        <xsl:choose>
                                            <xsl:when test="count($tags-ano/node[@id = $NodeIdCP]) &gt; 0">
                                                <xsl:element name="span">
                                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                                    <xsl:value-of select="./n:Tiers/n:Adresse/n:CP/@V"/></xsl:element>&nbsp;
                                            </xsl:when>
                                            <xsl:otherwise><xsl:value-of select="./n:Tiers/n:Adresse/n:CP/@V"/>&nbsp;</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:if>
                                    &nbsp;<!--xsl:value-of select="./n:Tiers/n:Adresse/n:Ville/@V"/-->
                                    <xsl:variable name="NodeIdVille" select="./n:Tiers/n:Adresse/n:Ville/@ano:node-id"/>
                                    <xsl:if test="string-length(./n:Tiers/n:Adresse/n:Ville/@V)">
                                        <xsl:choose>
                                            <xsl:when test="count($tags-ano/node[@id = $NodeIdVille]) &gt; 0">
                                                <xsl:element name="span">
                                                    <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                                    <xsl:value-of select="./n:Tiers/n:Adresse/n:Ville/@V"/></xsl:element>&nbsp;
                                            </xsl:when>
                                            <xsl:otherwise><xsl:value-of select="./n:Tiers/n:Adresse/n:Ville/@V"/>&nbsp;</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:if>
                                    <xsl:if test="boolean(./n:Tiers/n:Adresse/n:CodRes/@V)"> - <xsl:call-template name="codePaysINSEE" >
                                            <xsl:with-param name="codePays" select="./n:Tiers/n:Adresse/n:CodPays/@V" />
                                        </xsl:call-template>
                                    </xsl:if><br /><br/>
                                    <!-- CpteBancaire -->
                                    <span><xsl:variable name="nodeIdLibVir1" select="n:BlocLignePiece/n:InfoLignePce/n:LibVir1/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdLibVir1]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="n:BlocLignePiece/n:InfoLignePce/n:LibVir1/@V"/></span><br/>
                                    <xsl:variable name="currentNodeId" select="n:Tiers/n:CpteBancaire/@ano:node-id"/>
                                    <xsl:choose>
                                        <xsl:when test="count($tags-ano/node[@id = $currentNodeId]) &gt; 0">
                                            <xsl:element name="span">
                                                <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CodeEtab/@V"/>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CodeGuic/@V"/>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:IdCpte/@V"/>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CleRib/@V"/><br/>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:LibBanc/@V"/><br/>
                                                <xsl:value-of select="n:Tiers/n:CpteBancaire/n:IdBancInt/@V"/>
                                            </xsl:element>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CodeEtab/@V"/>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CodeGuic/@V"/>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:IdCpte/@V"/>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:CleRib/@V"/><br/>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:LibBanc/@V"/><br/>
                                            <xsl:value-of select="n:Tiers/n:CpteBancaire/n:IdBancInt/@V"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </td>
                                <xsl:element name="td">
                                    <xsl:attribute name="class">mandatCol2</xsl:attribute>
                                    <xsl:variable name="nodeIdIdLigne" select="n:BlocLignePiece/n:InfoLignePce/n:IdLigne/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $nodeIdIdLigne]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="n:BlocLignePiece/n:InfoLignePce/n:IdLigne/@V"/>
                                </xsl:element>
                                <td class="mandatCol3">
                                    <!-- On calcule le nombre de PJ pour chaque type de support -->
                                    <xsl:variable name="nbPJLigneElectro">
                                        <xsl:value-of select="count(n:BlocLignePiece/n:InfoLignePce/n:PJRef/n:Support[@V=01])"/>
                                    </xsl:variable>
                                    <xsl:variable name="nbPJLignePapier">
                                        <xsl:value-of select="count(n:BlocLignePiece/n:InfoLignePce/n:PJRef/n:Support[@V=02])"/>
                                    </xsl:variable>
                                    <xsl:variable name="nbPJLigneCDROM">
                                        <xsl:value-of select="count(n:BlocLignePiece/n:InfoLignePce/n:PJRef/n:Support[@V=03])"/>
                                    </xsl:variable>
                                    <!--xsl:call-template name="typePieceOrigine" >
                                        <xsl:with-param name="typePiece" select="n:BlocLignePiece/n:RattachPiece/n:NatPceOrig/@V" />                   
                                    </xsl:call-template-->
                                    <table class="inner" width="100%" cellspacing="0">
                                        <tr><td colspan="2" class="noborder"><span><xsl:variable name="nodeIdTypePieceOrig" select="n:BlocLignePiece/n:RattachPiece/n:NatPceOrig/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdTypePieceOrig]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:call-template name="typePieceOrigine" ><xsl:with-param name="typePiece" select="n:BlocLignePiece/n:RattachPiece/n:NatPceOrig/@V"/></xsl:call-template></span></td></tr>                               
                                        <!--tr><td class="noborder">Exercice</td><td class="noborder"><xsl:value-of select="./n:BlocLignePiece/n:RattachPiece/n:ExerRat/@V"/></td></tr-->
                                        <tr><td class="noborder">Exercice</td><td class="rigth noborder"><span><xsl:variable name="nodeIdExerRat" select="./n:BlocLignePiece/n:RattachPiece/n:ExerRat/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdExerRat]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="./n:BlocLignePiece/n:RattachPiece/n:ExerRat/@V"/></span></td></tr>
                                        <tr><td class="noborder">Identifiant pi&#232;ce</td><td class="noborder"><xsl:value-of select="./n:BlocLignePiece/n:RattachPiece/n:IdPceOrig/@V"/></td></tr>
                                        <tr><td class="noborder">Ligne pi&#232;ce</td></tr><tr><td class="noborder"><xsl:value-of select="./n:BlocLignePiece/n:RattachPiece/n:IdLigneOrig/@V"/></td></tr>
                                        <tr><td class="noborder" colspan="2"><!--xsl:choose>
                                            <xsl:when test="$nbPJLigneElectro + $nbPJLignePapier + $nbPJLigneCDROM = 0">Non justifi&#233;e</xsl:when>
                                            <xsl:otherwise-->
                                            Justifi&#233;e par <xsl:value-of select="$nbPJLigneElectro + $nbPJLignePapier + $nbPJLigneCDROM"/> PJ<xsl:if test="$nbPJLigneElectro + $nbPJLignePapier + $nbPJLigneCDROM &gt; 0"> dont :</xsl:if>
                                                <ul style="margin-top: 0px; margin-left: 0.5cm;">
                                                    <xsl:if test="$nbPJLigneElectro &gt; 0"><li><xsl:value-of select="$nbPJLigneElectro"/> en ligne<ul style="margin-top: 0; margin-left: 0.5cm; list-style-type: none;"><xsl:for-each select="./n:BlocLignePiece/n:InfoLignePce/n:PJRef[n:Support/@V=01]"><li><xsl:choose>
                                                        <xsl:when test="true()"><a><xsl:attribute name="href">xemelios:/attachment?pjId=<xsl:value-of select="./n:IdUnique/@V"/>&amp;collectivite=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:IdColl/@V"/></xsl:attribute><xsl:choose><xsl:when test="string-length(./n:Libelle/@V) &gt; 0"><xsl:value-of select="./n:Libelle/@V"/></xsl:when><xsl:otherwise><xsl:value-of select="./n:IdUnique/@V"/></xsl:otherwise></xsl:choose></a></xsl:when>
                                                        <xsl:otherwise><xsl:choose><xsl:when test="string-length(./n:Libelle/@V) &gt; 0"><xsl:value-of select="./n:Libelle/@V"/></xsl:when><xsl:otherwise><xsl:value-of select="./n:IdUnique/@V"/></xsl:otherwise></xsl:choose></xsl:otherwise>
                                                    </xsl:choose></li></xsl:for-each></ul></li></xsl:if>
                                                    <xsl:if test="$nbPJLignePapier &gt; 0"><li><xsl:value-of select="$nbPJLignePapier"/> papier<ul style="margin-top: 0; margin-left: 0.5cm; list-style-type: none;"><xsl:for-each select="./n:BlocLignePiece/n:InfoLignePce/n:PJRef[n:Support/@V=02]"><li><xsl:choose><xsl:when test="string-length(./n:Libelle/@V) &gt; 0"><xsl:value-of select="./n:Libelle/@V"/></xsl:when><xsl:otherwise><xsl:value-of select="./n:IdUnique/@V"/></xsl:otherwise></xsl:choose></li></xsl:for-each></ul></li></xsl:if>
                                                    <xsl:if test="$nbPJLigneCDROM &gt; 0"><li><xsl:value-of select="$nbPJLigneCDROM"/> sur CDROM<ul style="margin-top: 0; margin-left: 0.5cm; list-style-type: none;"><xsl:for-each select="./n:BlocLignePiece/n:InfoLignePce/n:PJRef[n:Support/@V=03]"><li><xsl:choose><xsl:when test="string-length(./n:Libelle/@V) &gt; 0"><xsl:value-of select="./n:Libelle/@V"/></xsl:when><xsl:otherwise><xsl:value-of select="./n:IdUnique/@V"/></xsl:otherwise></xsl:choose></li></xsl:for-each></ul></li></xsl:if>
                                                </ul><!--/xsl:otherwise>
                                        </xsl:choose--></td></tr>
                                    </table>
                                    
                                </td>
                                <td class="mandatCol4">
                                    <table class="inner" width="100%" cellspacing="0">
                                        <tr><td class="noborder">Facture</td><td class="noborder right"><xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:Facture/@V"/></td></tr>
                                        <tr><td class="noborder">Fiche inventaire</td><td class="noborder right"><span><xsl:variable name="nodeIdActif" select="./n:BlocLignePiece/n:LiensIdent/n:IdActif/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdActif]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="./n:BlocLignePiece/n:LiensIdent/n:IdActif/@V"/></span></td></tr>
                                        <tr><td class="noborder">Compte Tiers</td><td class="noborder right"><xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:CpteTiers/@V"/></td></tr>
                                        <tr><td class="noborder">Fiche emprunt</td><td class="noborder right"><span><xsl:variable name="nodeIdEmprunt" select="./n:BlocLignePiece/n:LiensIdent/n:IdEmpruntOrdo/@ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdEmprunt]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="./n:BlocLignePiece/n:LiensIdent/n:IdEmpruntOrdo/@V"/></span></td></tr>
                                        <tr><td class="noborder">Num&#233;ro de r&#233;gie</td><td class="noborder right"><span><xsl:variable name="nodeIdRegie" select="./n:BlocLignePiece/n:LiensIdent/n:IdRegie/ano:node-id"/><xsl:if test="count($tags-ano/node[@id = $nodeIdRegie]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="./n:BlocLignePiece/n:LiensIdent/n:IdRegie/@V"/></span></td></tr>
                                        <tr><td class="noborder">Num&#233;ro de march&#233;</td><td class="noborder right"><xsl:value-of select="./n:BlocLignePiece/n:LiensIdent/n:IdMarche/@V"/></td></tr>
                                        <tr><td class="noborder">Fiche de convention</td><td class="noborder right"><xsl:value-of select="./n:BlocLignePiece/n:LiensIdent/n:IdConv/@V"/></td></tr>
                                    </table>
                                </td>
                                <xsl:element name="td">
                                    <xsl:attribute name="class">mandatCol5</xsl:attribute>
                                    <xsl:variable name="nodeIdNature" select="./n:BlocLignePiece/n:InfoLignePce/n:Nature/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $nodeIdNature]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:Nature/@V"/>&nbsp;
                                </xsl:element>
                                <xsl:element name="td">
                                    <xsl:attribute name="class">mandatCol6</xsl:attribute>
                                    <xsl:variable name="nodeIdFonction" select="./n:BlocLignePiece/n:InfoLignePce/n:Fonction/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $nodeIdFonction]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:Fonction/@V"/>&nbsp;
                                </xsl:element>
                                <xsl:element name="td">
                                    <xsl:attribute name="class">mandatCol7</xsl:attribute>
                                    <xsl:variable name="nodeIdOperation" select="./n:BlocLignePiece/n:InfoLignePce/n:Operation/@ano:node-id"/>
                                    <xsl:if test="count($tags-ano/node[@id = $nodeIdOperation]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if>
                                    <xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:Operation/@V"/>&nbsp;
                                </xsl:element>
                                <td class="mandatCol8">
                                    <xsl:variable name="nodeHT" select="./n:BlocLignePiece/n:InfoLignePce/n:MtHT/@ano:node-id"/>
                                    <xsl:variable name="nodeTVA" select="./n:BlocLignePiece/n:InfoLignePce/n:MtTVA/@ano:node-id"/>
                                    <table class="inner" width="100%" cellspacing="0">
                                        <xsl:variable name="mtLigneHt"><xsl:choose>
                                            <xsl:when test="./n:BlocLignePiece/n:InfoLignePce/n:MtHT"><xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:MtHT/@V"></xsl:value-of></xsl:when>
                                            <xsl:otherwise>0</xsl:otherwise>
                                        </xsl:choose></xsl:variable>
                                        <xsl:variable name="mtLigneTva"><xsl:choose>
                                            <xsl:when test="./n:BlocLignePiece/n:InfoLignePce/n:MtTVA"><xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:MtTVA/@V"></xsl:value-of></xsl:when>
                                            <xsl:otherwise>0</xsl:otherwise>
                                        </xsl:choose></xsl:variable>
                                        <tr><td class="noborder">Montant HT</td><td class="noborder right"><xsl:element name="span"><xsl:if test="count($tags-ano/node[@id = $nodeHT]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:call-template name="number"><xsl:with-param name="num" select="$mtLigneHt"/></xsl:call-template></xsl:element></td></tr>
                                        <tr><td class="noborder">Montant TVA</td><td class="noborder right"><xsl:element name="span"><xsl:if test="count($tags-ano/node[@id = $nodeTVA]) &gt; 0"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:call-template name="number"><xsl:with-param name="num" select="$mtLigneTva"/></xsl:call-template></xsl:element></td></tr>
                                        <tr><td class="noborder">Compte TVA</td><td class="noborder right"><xsl:value-of select="./n:BlocLignePiece/n:InfoLignePce/n:CpteTVA/@V"/></td></tr>
                                        <tr><td class="noborder">Montant TTC</td><td class="noborder right"><xsl:call-template name="number"><xsl:with-param name="num" select="$mtLigneTva+$mtLigneHt"/></xsl:call-template></td></tr>
                                        <tr><td class="noborder" colspan="2">&nbsp;</td></tr>
                                        <tr><td class="noborder" colspan="2">D&#233;lais global de paiement :</td></tr>
                                        <xsl:choose>
                                            <xsl:when test="../n:BlocPiece/n:DGP">
                                                <xsl:variable name="nodeDateDeb" select="../n:BlocPiece/n:DGP/n:DteDebDgp/@ano:node-id"/>
                                                <xsl:variable name="isNodeDateDebError" select="count($tags-ano/node[@id = $nodeDateDeb]) &gt; 0"/>
                                                <xsl:variable name="nodeDateFin" select="../n:BlocPiece/n:DGP/n:DteFinDgp/@ano:node-id"/>
                                                <xsl:variable name="isNodeDateFinError" select="count($tags-ano/node[@id = $nodeDateFin]) &gt; 0"/>
                                                <xsl:variable name="nodeDureeDgp" select="../n:BlocPiece/n:DGP/n:DureeDgp/@ano:node-id"/>
                                                <xsl:variable name="isNodeDureeDgp" select="count($tags-ano/node[@id = $nodeDureeDgp]) &gt; 0"/>
                                                <tr><td class="noborder">&nbsp;&nbsp;&nbsp;&nbsp;D&#233;lai global</td><td class="noborder right"><xsl:element name="span"><xsl:if test="$isNodeDureeDgp"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:value-of select="../n:BlocPiece/n:DGP/n:DureeDgp/@V"/> jours</xsl:element></td></tr>
                                                <tr><td class="noborder">&nbsp;&nbsp;&nbsp;&nbsp;Date d&#233;but DGP</td><td class="noborder right"><xsl:element name="span"><xsl:if test="$isNodeDateDebError"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:call-template name="slash-date"><xsl:with-param name="datebrute" select="../n:BlocPiece/n:DGP/n:DteDebDgp/@V"/></xsl:call-template></xsl:element></td></tr>
                                                <tr><td class="noborder">&nbsp;&nbsp;&nbsp;&nbsp;Date fin DGP</td><td class="noborder right"><xsl:element name="span"><xsl:if test="$isNodeDateFinError"><xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute></xsl:if><xsl:call-template name="slash-date"><xsl:with-param name="datebrute" select="../n:BlocPiece/n:DGP/n:DteFinDgp/@V"/></xsl:call-template></xsl:element></td></tr>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <tr><td class="noborder" colspan="2">
                                                <xsl:variable name="currentNodeId" select="../n:BlocPiece/@ano:node-id"/>
                                                <xsl:choose>
                                                    <xsl:when test="count($tags-ano/node[@id = $currentNodeId]) &gt; 0">
                                                        <xsl:element name="span">
                                                            <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                                            [NON RENSEIGNE]
                                                        </xsl:element>
                                                    </xsl:when>
                                                    <xsl:otherwise>[NON RENSEIGNE]</xsl:otherwise>
                                                </xsl:choose>
                                                </td></tr>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </table>
                                </td>
                                </xsl:element>
                            </xsl:for-each>
                            <!-- pour les totaux -->
                            <tr style="text-align: left">
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="mandatCol8"><table class="inner" width="100%" cellspacing="0"><tr><td class="noborder">TOTAL HT</td><td class="noborder right"><xsl:call-template name="number"><xsl:with-param name="num" select="$totalHT"/></xsl:call-template></td></tr></table></td>
                            </tr>
                            <tr style="text-align: left">
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="noborder">&nbsp;</td>
                                <td class="mandatCol8"><table class="inner" width="100%" cellspacing="0"><tr><td class="noborder">TOTAL TTC</td><td class="noborder right"><xsl:call-template name="number"><xsl:with-param name="num" select="$totalTTC"/></xsl:call-template></td></tr></table></td>
                            </tr>
                        </table>
                        <p/>
                        <xsl:if test="./ano:Anomalie">
                            <hr />
                            <xsl:for-each select="./ano:Anomalie">
                                <xsl:element name="div">
                                    <xsl:if test="$anoId = ./@ano:anoId">
                                        <xsl:attribute name="style">background-color: #FFFF66;</xsl:attribute>
                                    </xsl:if>
                                    <!--a><xsl:attribute name="name">AnoId_<xsl:value-of select="./@ano:anoId"/></xsl:attribute> </a-->
                                    <xsl:variable name="idBordereau"><xsl:value-of select="../../@added:primary-key"/></xsl:variable>
                                    <xsl:variable name="idPiece"><xsl:value-of select="../n:BlocPiece/n:InfoPce/n:IdPce/@V"/></xsl:variable>
                                    <h3>
                                        <xsl:element name="a">
                                            <xsl:attribute name="name">AnoId_<xsl:value-of select="./@ano:anoId"/></xsl:attribute>
                                            <xsl:attribute name="href">xemelios:/query?docId=PES_Aller&amp;etatId=PES_DepenseAller&amp;elementId=BordereauDepense&amp;collectivite=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:IdColl/@V"/>&amp;budget=<xsl:value-of select="/n:PES_Aller/n:EnTetePES/n:CodBud/@V"/>&amp;path=[@added:primary-key='<xsl:value-of select="$idBordereau"/>']&amp;xsl:param=(mandatId,<xsl:value-of select="$idPiece"/>)&amp;xsl:param=(anoId,<xsl:value-of select="./@ano:anoId"/>)</xsl:attribute>
                                            Anomalie <!--xsl:value-of select="./@ano:anoId"/-->
                                        </xsl:element>
                                    </h3>
                                    <p><span class="gras">Contr&#244;le : </span><xsl:value-of select="./@ano:ctrlLibelle"/>&nbsp;(<xsl:value-of select="./@ano:ctrlId"/>)</p>
                                <p><span class="gras">R&#232;gle fonctionnelle : </span><xsl:value-of select="./ano:ctrlRegleFonct/text()" disable-output-escaping="yes"/></p>
                                <p><span class="gras">Message : </span><xsl:value-of select="./ano:message/text()" disable-output-escaping="yes"/></p>
                                <!--p><span class="gras">Noeuds : </span><xsl:for-each select="ano:node"><xsl:value-of select="./@ano:id"/>, </xsl:for-each></p-->
                                </xsl:element>
                            </xsl:for-each>
                            <hr />
                        </xsl:if>
                    </xsl:for-each>
                </xsl:otherwise>
            
                </xsl:choose>
                    
                    <!-- une table pour le pied de page, le m&#234;me pour le bordereau et le mandat -->
                    <!--table class="footer" cellspacing="0">
                        <tr>
                            <td class="colonne1" style="border-style:none">Edition du&nbsp;<xsl:call-template name="slash-date">
                                <xsl:with-param name="datebrute" select="./n:PES_DepenseAller/n:Bordereau/n:BlocBordereau/n:DteBordEm/@V"></xsl:with-param>
                            </xsl:call-template>
                            </td>
                            <td class="colonne2" style="border-style:none">&nbsp;</td>
                            <td class="colonne3" style="border-style:none">&nbsp;</td>
                            <td class="colonne4" style="border-style:none">&nbsp;</td>
                        </tr>
                    </table-->
                    
                <!--/div-->
            </body>        
            
            </html>
    </xsl:template>

</xsl:stylesheet>
