<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Feuille de transformation appliquée au Fichier CDM 
de sortie "BRUTE"  du système de stockage de l'application
de gestion de fragments (Catalogue de formation,  ...)
Ce ficher est choisi automatiquement par l'application 
en cas de retour d'un fragment unique du type d'objet demandé
     Author: Loic Pénet, lpenet@poleuniv-lille-npdc.fr
     Equipe:Claude Vieville, Loic Pénet, Brigitte Wallaert.
     CRI Université des Sciences et Technologies de Lille
     Version 1.00  12/06/2006 $Revision$
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns2="http://cdm-fr.fr/2011/CDM-frSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
  <xsl:output method="xml" encoding="ISO-8859-1" doctype-public="oeuvre.dtd" indent="yes"/>
  <!--  -->
  <xsl:param name="_lang">fr-FR</xsl:param>
  <xsl:param name="debug"/>
  <xsl:param name="_oid"/>
  <xsl:param name="_oidProgram"/>
  <xsl:param name="_oidProgramAnnexe"/>
  <xsl:param name="appContext"/>
  <!--  -->
  <xsl:variable name="nbProg" select="count(/CDM/program)"/>
  <xsl:variable name="uniform"> cdm2 pdf version 1.10 beta</xsl:variable>
  <!-- VARIABLES VALEURS TEXTES UTILISEES PAR L AFFICHAGE  -->
  <xsl:variable name="variablesExt" select="document('../commun/variablesExt.xml')"/>
  <xsl:variable name="baseMediaPdf" select="concat($appContext,$variablesExt/variables/contentpdfvar/baseMediaPdf)"/>
  <!-- formatage -->
  <xsl:variable name="tailleTexteEntete" select="$variablesExt/variables/contentpdfvar/formatage/tailleTexteEntete/@select"/>
  <xsl:variable name="spaceBeforeTitre" select="$variablesExt/variables/contentpdfvar/formatage/spaceBeforeTitre/@select"/>
  <xsl:variable name="spaceBeforeTitre2" select="$variablesExt/variables/contentpdfvar/formatage/spaceBeforeTitre2/@select"/>
  <xsl:variable name="tailleTitre" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre/@select"/>
  <xsl:variable name="tailleTitre2" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre2/@select"/>
  <xsl:variable name="tailleTitre3" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre3/@select"/>
  <xsl:variable name="tailleTitre4" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre4/@select"/>
  <xsl:variable name="tailleTitre5" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre5/@select"/>
  <xsl:variable name="tailleTexte" select="$variablesExt/variables/contentpdfvar/formatage/tailleTexte/@select"/>
  <xsl:variable name="retraitTexte1" select="$variablesExt/variables/contentpdfvar/formatage/retraitTexte1/@select"/>
  
  <xsl:variable name="distancEntreParag" select="$variablesExt/variables/contentpdfvar/formatage/distancEntreParag/@select"/>

  <xsl:variable name="typeFormation">
    <xsl:choose>
      <xsl:when test="not(normalize-space(/CDM/program[position()=1]/qualification/degree)) = ''">
        <xsl:value-of select="/CDM/program[position()=1]/qualification/degree"/>
      </xsl:when>
    </xsl:choose>
  </xsl:variable>
  <!--fin Attente CDM  -->
  <xsl:variable name="oidFormation" select="/CDM/program[position()=1]/@ident"/>
  <!-- 1=program 2=subprogram -->
  <xsl:variable name="typeObjet">
    <xsl:choose>
      <!-- plusieurs elements program donc des subprogram -->
      <xsl:when test="not(count(/CDM/program)=1)">
        <xsl:choose>
          <!-- l oid es celui du premier donc program -->
          <xsl:when test="not(normalize-space($_oidProgramAnnexe) = '')">2</xsl:when>
          <xsl:when test="$_oid = $oidFormation">1</xsl:when>
          <!-- l oid est vide c donc program -->
          <xsl:when test="$_oid = '' ">1</xsl:when>
          <xsl:otherwise>2</xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>1</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="nbrSubProgram" select="count(/CDM/program) - 1"/>
  <!--  -->
  <xsl:variable name="couleur">
    <xsl:choose>
      <xsl:when test="not(normalize-space(/CDM/program[position()=1]/qualification/degree) = '')">
        <xsl:variable name="valeur" select="normalize-space(/CDM/program[position()=1]/qualification/degree)"/>
        <xsl:value-of select="$variablesExt/variables/contentpdfvar/couleurTexte/couleurTitre[@degree = $valeur]/@color"/>
        <!-- normalize-space(/CDM/program[position()=1]/qualification/degree) -->
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$variablesExt/variables/contentpdfvar/couleurTexte/couleurTitre[@degree='nr']/@color"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- ATTENTION LE CALCUL SE FAIT SUR LE PROGRAM 1 -->
  <xsl:variable name="duree">
    <!-- <xsl:value-of select="number(/CDM/program[position()=$indexFormation]/qualification/credits/@ECTScredits) div 30"/> -->
    <xsl:value-of select="number(/CDM/program[position()=1]/qualification/credits/@ECTScredits) div 30"/>
  </xsl:variable>
  <xsl:variable name="creditRequis">
    <xsl:choose>
      <!-- <xsl:when test="/CDM/program[position()=$indexFormation]/qualification/degree/@degree=bachelor"> -->
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-DEUG'">
        <xsl:value-of select="0"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-DUT'">
        <xsl:value-of select="0"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-DEUST'">
        <xsl:value-of select="30"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-lip'">
        <xsl:value-of select="120"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='Ti-li'">
        <xsl:value-of select="0"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-mas'">
        <xsl:value-of select="180"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-map'">
        <xsl:value-of select="180"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-mar'">
        <xsl:value-of select="180"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-dii'">
        <xsl:value-of select="120"/>
      </xsl:when>
      <xsl:when test="/CDM/program[position()=1]/qualification/degree='TI-iup'">
        <xsl:value-of select="120"/>
      </xsl:when>
      <xsl:when test="normalize-space(/CDM/program[position()=1]/qualification/degree)=''">
        <xsl:value-of select="'nr'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="valCreditECTS">
    <!-- <xsl:value-of select="number(/CDM/program[position()=$indexFormation]/qualification/credits/@ECTScredits)"/> -->
    <xsl:value-of select="number(/CDM/program[position()=1]/qualification/credits/@ECTScredits)"/>
  </xsl:variable>

  <!-- modifie pr pdf -->
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <!-- definir le  layout master -->
      <fo:layout-master-set>
        <!--  ORIGINAL -->
        <!--
			<fo:simple-page-master master-name="all-pages" page-height="29.7cm" page-width="21cm">
			  <fo:region-body region-name="xsl-region-body" margin="1.3cm" padding="7pt"/>
			  <fo:region-before region-name="xsl-entete-suite" extent="1.5cm" display-align="before" padding="6pt 1cm"/>
			  <fo:region-after region-name="bas_page-suite" extent="1cm" display-align="after" padding="6pt 1cm"/>
			</fo:simple-page-master>
		-->
        <!--  MODIFIE -->
        <fo:simple-page-master master-name="all-pages" page-height="29.7cm" page-width="21cm">
          <fo:region-body region-name="xsl-region-body" border="0cm" margin="1.3cm" padding="0cm"/>
          <fo:region-before region-name="xsl-entete-suite" extent="1.5cm" display-align="before" border="0cm" padding="0cm"/>
          <fo:region-after region-name="bas_page-suite" extent="1cm" display-align="after" border="0cm" padding="0cm"/>
        </fo:simple-page-master>
        <!--  -->

        <fo:page-sequence-master master-name="default-sequence">
          <fo:repeatable-page-master-reference master-reference="all-pages"/>
        </fo:page-sequence-master>
      </fo:layout-master-set>
      <!-- definir les sequences de page -->

     

      <xsl:comment>Pages suivantes</xsl:comment>
      <fo:page-sequence master-reference="default-sequence" initial-page-number="1">
        <fo:static-content flow-name="xsl-entete-suite">
          <fo:block space-before="20pt" space-after="9pt" text-align="center" font-family="Helvetica" font-size="{$tailleTexteEntete}pt" font-weight="bold" color="{$couleur}">
            <!--  -->
            <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='9']/value[@lang=$_lang]"/>
          </fo:block>
        </fo:static-content>

        <fo:static-content flow-name="bas_page-suite">
          <fo:table>
            <fo:table-column column-width="17cm"/>
            <fo:table-column column-width="3cm"/>
            <fo:table-body>
              <fo:table-row>
                <fo:table-cell padding="0pt" border="0" text-align="center" width="80px">
                  <fo:block text-align="center" font-family="Helvetica" font-size="{$tailleTexte}pt" font-style="italic" color="{$couleur}">
                    <!-- Catalogue des formations de  -->
                    <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='2']/value[@lang=$_lang]"/>
                    <!-- mot de liaison  -->
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='3']/value[@lang=$_lang]"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="/CDM/orgUnit/orgUnitName/text"/>
                  </fo:block>
                </fo:table-cell>
                <fo:table-cell padding="0pt" border="0" text-align="end">
                  <fo:block font-family="Helvetica" font-size="{$tailleTexteEntete}pt" text-align="end">Page <fo:page-number/>
                  </fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
        </fo:static-content>

        <fo:flow flow-name="xsl-region-body" border="0" padding="0">
          <xsl:choose>
            <xsl:when test="$nbProg = 1">
              <!-- program -->
              <xsl:apply-templates select="/CDM/program[position()=1]">
                <xsl:with-param name="typeObjet_pdf" select="1"/>
              </xsl:apply-templates>
            </xsl:when>
            <xsl:when test="$nbProg &gt; 1">
              <xsl:apply-templates select="/CDM/program[position()=1]">
                <xsl:with-param name="typeObjet_pdf" select="1"/>
              </xsl:apply-templates>
              <!--  c'est un suBrogram -->
              <xsl:apply-templates select="/CDM/program[not(position()=1)]">
                <xsl:with-param name="typeObjet_pdf" select="2"/>
              </xsl:apply-templates>
            </xsl:when>
          </xsl:choose>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>


  <!--  -->
  <!-- ****************TEMPLATE SANS TRAITEMENT AUTO ******************* -->
  <xsl:template match="orgUnit"/>
  <!--  -->
  <xsl:template match="program">
    <xsl:param name="typeObjet_pdf"/>

    <xsl:variable name="break_pdf">
      <xsl:choose>
        <xsl:when test="$typeObjet_pdf = 2">
          <xsl:value-of select="'page'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'inherit'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <fo:block break-before="{$break_pdf}" keep-together="always">
      <!-- lolo debug (break_pdf=<xsl:value-of select="$break_pdf"/>) -->
      <!-- *********** INTRO *************** -->
      <!--_________debut_____________ haut  titre____________________________-->


      
      
      
      <fo:block space-before="20pt" space-after="9pt" text-align="center" font-family="Helvetica" font-size="{$tailleTitre2}pt" font-weight="bold" color="{$couleur}">
 <!--<xsl:variable name="margehaute" select="$variablesExt/variables/contentpdfvar/formatage/hauteurLogo/@select + 80"/>-->
<xsl:variable name="margehaute" select="80"/> 
<xsl:choose>
					<xsl:when test="@ident=/CDM/program[1]/@ident">
						<fo:table min-height="{$margehaute}px" background-image="url({$baseMediaPdf}/images/ustl.gif)" background-repeat="no-repeat">
							<fo:table-column/>
							<fo:table-body>
								<fo:table-row>
									<fo:table-cell height="100px" padding="0pt" border="0">
										<fo:block margin-left="100px" space-before="{$variablesExt/variables/contentpdfvar/formatage/margeHaute/@select}pt" font-size="{$tailleTitre}pt">
											<xsl:apply-templates select="./programName/text[@language=$_lang or not(@language)]">
												<xsl:with-param name="taille-Texte" select="$tailleTitre3"/>
												<xsl:with-param name="text-align" select="'center'"/>
											</xsl:apply-templates>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</fo:table-body>
						</fo:table>
					</xsl:when>
					<xsl:otherwise>
						<fo:table min-height="{$margehaute}px">
							<fo:table-column/>
							<fo:table-body>
								<fo:table-row>
									<fo:table-cell padding="0pt" border="0">
										<fo:block margin-left="{$variablesExt/variables/contentpdfvar/formatage/margeGauche/@select}px" space-before="{$variablesExt/variables/contentpdfvar/formatage/margeHaute/@select}pt" font-size="{$tailleTitre}pt">
											<xsl:apply-templates select="./programName/text[@language=$_lang or not(@language)]">
												<xsl:with-param name="taille-Texte" select="$tailleTitre3"/>
												<xsl:with-param name="text-align" select="'center'"/>
											</xsl:apply-templates>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</fo:table-body>
						</fo:table>
					</xsl:otherwise>
				</xsl:choose>
        
      </fo:block>
      <!--__________________fin_____ haut  titre____________________________-->
      
      <!-- *************** zone1   TYPE DE FORMATION   ****************** -->
      <!-- credit -->
      <fo:block>
        <!-- Cette formation donne droit à terme à -->
        <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='4']/value[@lang=$_lang]"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$valCreditECTS"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$variablesExt/variables/courseVar/header[@type=5]/value[@lang=$_lang]"/>
        <xsl:if test="ceiling($valCreditECTS &gt; 0)">s</xsl:if>
        <xsl:text> </xsl:text>
      </fo:block>
      <!--  duree en Semestre -->
      <fo:block>
        <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='5']/value[@lang=$_lang]"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$duree"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$variablesExt/variables/courseVar/header[@type=2]/value[@lang=$_lang]"/>
        <xsl:if test="ceiling($valCreditECTS &gt; 0)">s</xsl:if>
      </fo:block>
      <!-- 
      <fo:block>
        valCreditECTS= (<xsl:value-of select="number($valCreditECTS)"/>)
        <xsl:text> </xsl:text>
        creditRequis= (<xsl:value-of select="$creditRequis"/>)
      </fo:block> 
      -->
      <xsl:if test="not($creditRequis = 'nr')">
        <xsl:call-template name="tableau">
          <xsl:with-param name="valCreditECTS">
            <xsl:value-of select="number($valCreditECTS)"/>
          </xsl:with-param>
          <xsl:with-param name="creditRequis">
            <xsl:value-of select="number($creditRequis)"/>
          </xsl:with-param>
          <xsl:with-param name="total">0</xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- *************** fin zone1   TYPE DE FORMATION   ****************** -->
      <!-- Description du programme -->
      <xsl:variable name="leTitre">
        <xsl:choose>
          <xsl:when test="$typeObjet_pdf=2">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='45']/value[@lang=$_lang]"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='1']/value[@lang=$_lang]"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <xsl:call-template name="section">
        <xsl:with-param name="node" select="./programDescription"/>
        <xsl:with-param name="titre">
          <xsl:value-of select="$leTitre"/>
        </xsl:with-param>
      </xsl:call-template>
      <!-- Spécificités -->
      <xsl:call-template name="section">
        <xsl:with-param name="node" select="./learningObjectives"/>
        <xsl:with-param name="titre">
          <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='4']/value[@lang=$_lang]"/>
        </xsl:with-param>
      </xsl:call-template>
      <!-- Pré-requis  -->
      <xsl:call-template name="section">
        <xsl:with-param name="node" select="./formalPrerequisites"/>
        <xsl:with-param name="titre">
          <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='5']/value[@lang=$_lang]"/>
        </xsl:with-param>
      </xsl:call-template>
      <!-- Métiers envisagés-->
      <xsl:call-template name="section">
        <xsl:with-param name="node" select="./qualification/profession"/>
        <xsl:with-param name="titre">
          <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='2']/value[@lang=$_lang]"/>
        </xsl:with-param>
      </xsl:call-template>
      <!--Les métiers par code rom -->
      <xsl:call-template name="section">
        <xsl:with-param name="node" select="./qualification/studyQualification"/>
        <xsl:with-param name="titre">
          <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='3']/value[@lang=$_lang]"/>
        </xsl:with-param>
      </xsl:call-template>
      <!--  Savoirs enseignés  -->
      <xsl:if test="not(normalize-space(./recommendedPrerequisites/subBlock)='')">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./recommendedPrerequisites"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='6']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!--   -->
      <xsl:if test="$typeObjet_pdf=1">
        <xsl:apply-templates select="/CDM/orgUnit/infoBlock[@userDefined='droiScol']"/>
      </xsl:if>
      <!--  commenter si pas utilisation Nombre de places dans la formation -->
      <xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@rubrique='admissionInfo']/@select=1">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./admissionInfo"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='28']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- Etudes à l'étranger  -->
      <xsl:if test="not(normalize-space(./studyAbroad/subBlock)='')">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./studyAbroad"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='9']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- Dépenses à prévoir OPTION parametrable -->
      <xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@rubrique='expenses']/@select='1'">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./expenses"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='10']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- Facilités pour les personnes handicapées OPTION parametrable-->
      <xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@rubrique='universalAdjustment']/@select=1">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./universalAdjustment"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='11']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- exemple de traitement d'un infoBlock
			<xsl:apply-templates select="./infoBlock/subBlock[header='Matières dominantes']"/>
			-->
      <!--  Modes pédagogiques  A voir -->
      <xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@rubrique='formOfTeaching']/@select=1">
        <xsl:call-template name="section">
          <xsl:with-param name="node" select="./formOfTeaching"/>
          <xsl:with-param name="titre">
            <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='23']/value[@lang=$_lang]"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <!-- lolo pdf -->
      <!-- ************************* SELECTION DES SEMESTRES ************************* -->
      <!-- resultat (1 lien vers les courses) (2 lien vers les program du dessous) -->
  
      <!-- debut contact de la Formation et coordonnees-->
      <fo:block space-before.optimum="14pt" keep-together="always">

        <fo:block margin-left="{$retraitTexte1}mm">
          <xsl:apply-templates select="./contacts"/>

        </fo:block>
        <!-- Lieu de la formation -->
        <xsl:apply-templates select="./teachingPlace"/>
        <fo:block margin-left="{$retraitTexte1}mm">
          <!-- Lien vers le URL web de la formation -->
          <xsl:apply-templates select="./webLink"/>
        </fo:block>
      </fo:block>

      <xsl:apply-templates select="./infoBlock"/>
<!-- Block de description des semestres -->
      <fo:block space-before.optimum="14pt">
      <!-- Je suis une formation et j'annonce les parcours (autres subprogram)-->
        <xsl:choose>
          <xsl:when test="($nbrSubProgram &gt; 1) and ($typeObjet_pdf = 1)">
            <xsl:call-template name="Titreheader_pdf">
              <!--titre  Parcours -->
              <xsl:with-param name="titre" select="$variablesExt/variables/titreVar/titreRub[@type='18']/value[@lang=$_lang]"/>
              <xsl:with-param name="niveau" select="3"/>
            </xsl:call-template>
            <xsl:call-template name="listeSubProgram"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:choose>
              <xsl:when test="count(./descendant::subProgram) &gt; 0">
                <xsl:apply-templates select="./descendant::subProgram"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="./descendant::programStructure"/>
              </xsl:otherwise>
            </xsl:choose>     
          </xsl:otherwise>
        </xsl:choose>
      </fo:block>
      <!-- FIN Block de description des semestres -->
      <!-- FIN Contenus de la formation  -->
      <!-- ***************************** AFFICHAGE DE LA ZONE DES INFORMATIONS  ***************************** -->
    </fo:block>

  </xsl:template>
  <!-- ***************   TEMPLATES DANS program    *************** -->
  <!-- <xsl:template match="programName">
    <xsl:value-of select="./text"/>
  </xsl:template>
  -->
  <xsl:template match="programCode">
    <!--  
		<xsl:choose>
			<xsl:when test="$variablesExt/variables/programVar/variable[@type='referenciel']/@value = ''">
				<xsl:if test="normalize-space(.)"> codeSet=<xsl:value-of select="./@codeSet"/><xsl:text> </xsl:text> value=<xsl:value-of
						select="normalize-space(.)"/><xsl:text> </xsl:text>

					<xsl:variable name="attribut" select="./@codeSet"/>
					<xsl:variable name="valAttribut" select="./@codeSet"/>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
		-->
    <!-- On definit ici -->
    <!-- En attente

			<xsl:value-of select="./@codeSet"/>: 
		<xsl:value-of select="."/>
		 -->
  </xsl:template>
  <!-- Chemin depuis racine car webLink peut etre a differents niveaux 
	<xsl:template match="/CDM/program/webLink[@role='homepage']">
		<xsl:apply-templates select="href">
			<xsl:with-param name="navigationItem" select="$variablesExt/variables/navigationVar/navigationItem[@type='13']/value[@lang=$_lang]"/>
			<xsl:with-param name="linkTitle" select="$variablesExt/variables/navigationVar/linkTitle[@type='13']/value[@lang=$_lang]"/>
		</xsl:apply-templates>
	</xsl:template>
	-->
  <!--  -->
  <xsl:template match="qualification">
    <fo:block space-before.optimum="14pt" font-size="{$tailleTexte}pt">
      <xsl:call-template name="Titreheader_pdf">
        <xsl:with-param name="titre" select="$variablesExt/variables/titreVar/titreRub[@type='0']/value[@lang=$_lang]"/>
      </xsl:call-template>
      <xsl:call-template name="texteFormate_pdf"/>
    </fo:block>
  </xsl:template>
  <!-- ***************   TEMPLATES DANS program/qualification    *************** -->
  <xsl:template match="qualificationDescription">
    <xsl:call-template name="Titreheader_pdf">
      <xsl:with-param name="titre" select="$variablesExt/variables/titreVar/titreRub[@type='0.0']/value[@lang=$_lang]"/>
    </xsl:call-template>
    <xsl:call-template name="texteFormate_pdf"/>
  </xsl:template>
  <!--  -->
  <!-- element credits utilisé dans variable -->
  <!-- element degree utilisé dans variable -->



  <!-- *************** FIN  TEMPLATES DANS program/qualification    *************** -->
  <!-- program/level  -->
  <!--  decommenter si utilisation
    <xsl:template match="level">
    <fo:block>
            <xsl:call-template name="Titreheader_pdf">
		<xsl:with-param name="titre" select="$variablesExt/variables/titreVar/titreRub[@type='7']/value[@lang=$_lang]"/>
            </xsl:call-template>
            <xsl:call-template name="texteFormate_pdf"/>
    </fo:block>  
    </xsl:template> 
        -->
  <!--  decommenter si  pas utilisation  -->
  <!--  -->
  <xsl:template match="admissionDescription">
    <xsl:apply-templates select="node()"/>
  </xsl:template>
  <!--  -->
  <!--   Effectif moyen -->
  <xsl:template match="studentPlaces">
    <fo:block>
      <fo:wrapper font-weight="bold">
      <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='22']/value[@lang=$_lang]"/>
      </fo:wrapper>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./@places"/>
    </fo:block>
    <xsl:apply-templates select="node()"/>
  </xsl:template>
  <!-- Début des cours -->
  <xsl:template match="teachingStart">
    <xsl:if test="not(./@date='')">
      <fo:block>
      <fo:wrapper font-weight="bold">
        <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='31']/value[@lang=$_lang]"/>
      </fo:wrapper>
      <xsl:text> </xsl:text>
      <xsl:value-of select="./@date"/>
     </fo:block>
      <xsl:apply-templates select="node()"/>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="registrationDeadline">
    <xsl:if test="not(./@date='')">
      <fo:block>
      <fo:wrapper font-weight="bold">
        <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='32']/value[@lang=$_lang]"/>
      </fo:wrapper>
      <xsl:text> </xsl:text>
      <xsl:value-of select="./@date"/>
      </fo:block>
      <xsl:apply-templates select="node()"/>
    </xsl:if>
  </xsl:template>
  <!-- Non traite pour l'instant -->
  <xsl:template match="cancelDeadline"/>
  <!--  -->
  <!-- programDuration -->
  <xsl:template match="programDuration"/>
<!--  -->
  <xsl:template match="refCourse">
    <fo:table-row keep-with-next="always">
      <fo:table-cell>
        <xsl:variable name="refC">
          <xsl:choose>
            <xsl:when test="not(normalize-space(./@ref)) =''">
              <xsl:value-of select="normalize-space(./@ref)"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="normalize-space(./@idRef)"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>       
        <!--  space-before.optimum="{$distancEntreParag}mm" -->
        <fo:block font-size="{$tailleTexte}pt" keep-together="always">
          <xsl:if test="$debug = 1">
            <fo:block font-weight="bold" font-style="italic" color="#e22202">[template : refCourse ] ref dela course ==<xsl:value-of select="$refC"/></fo:block>
          </xsl:if>
          <fo:wrapper font-weight="bold">* </fo:wrapper><xsl:value-of select="/CDM/course[@ident=$refC]/courseName/text"/> (<xsl:value-of select="/CDM/course[@ident=$refC]/credits/@ECTScredits"/> crédits) </fo:block>
      </fo:table-cell>
    </fo:table-row>
  </xsl:template>
<!--  -->
  <xsl:template match="subBlock[refCourse]">
    <fo:table table-layout="fixed">
      <fo:table-column column-width="5pt"/>
      <fo:table-column/>
      <fo:table-body>
        <fo:table-row keep-with-next="always">
          <fo:table-cell>
            <fo:block/>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block space-before.optimum="{$distancEntreParag}mm" font-size="{$tailleTexte}pt" keep-together="always" font-weight="bold" font-style="italic">
            <xsl:choose>
              <xsl:when test="not(normalize-space(./header) = '')">
                <xsl:value-of select="./header"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type=10]/value"/>
              </xsl:otherwise>
            </xsl:choose>
              <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type=8]/value"/>
             </fo:block>

          </fo:table-cell>
        </fo:table-row>
        <xsl:for-each select="./refCourse">
          <fo:table-row keep-with-next="always">
            <fo:table-cell>
              <fo:block/>
            </fo:table-cell>
            <fo:table-cell>
              <xsl:variable name="refC">
                <xsl:choose>
                  <xsl:when test="not(normalize-space(./@ref)) =''">
                    <xsl:value-of select="normalize-space(./@ref)"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="normalize-space(./@idRef)"/>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:variable>            
              <!--  space-before.optimum="{$distancEntreParag}mm" -->

                <xsl:choose>
                  <xsl:when test="$variablesExt/variables/contentpdfvar/formatage/optionAffichage[@rubrique='course']/@select = 1">
                    <xsl:apply-templates select="/CDM/course[@ident=$refC]"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <fo:block font-size="{$tailleTexte}pt" keep-together="always">
                      <fo:wrapper font-weight="bold">* </fo:wrapper><xsl:value-of select="/CDM/course[@ident=$refC]/courseName/text"/> (<xsl:value-of select="/CDM/course[@ident=$refC]/credits/@ECTScredits"/> crédits) 
                    </fo:block>     
                  </xsl:otherwise>
                </xsl:choose>
                
                
            </fo:table-cell>
          </fo:table-row>
        </xsl:for-each>
      </fo:table-body>
    </fo:table>
  </xsl:template>
  <!-- programStructure -->
  <xsl:template match="programStructure">
    <xsl:param name="ident"/>
    <!-- <xsl:param name="premUE"/> -->
    <xsl:param name="_semestre"/>
    <xsl:if test="$debug = 1">
      <fo:block font-weight="bold" font-style="italic" color="#e22202">[template : programStructure  ident = (<xsl:value-of select="$ident"/>) _semestre = (<xsl:value-of select="$_semestre"/>) </fo:block>   
      <fo:block>
        nombre de refProgram descendant= <xsl:value-of select="count(./descendant::refProgram)"/>
      </fo:block>  
      <fo:block>
      nombre de refCourse descendant= <xsl:value-of select="count(./descendant::refCourse)"/>
      </fo:block>
    </xsl:if>
    <xsl:if test="not(normalize-space(./header)) = ''">
      <fo:block font-weight="bold" color="{$couleur}" font-size="{$tailleTitre4}pt" space-before.optimum="{spaceBeforeTitre}mm">
      <fo:external-graphic src="{$baseMediaPdf}/pictos/carre44{$typeFormation}.gif" scaling="non-uniform" alignment-adjust="0%"/>
      <xsl:text> </xsl:text> 
<xsl:value-of select="./header"/>
    </fo:block>
</xsl:if>
   <xsl:choose>
     <xsl:when test="count(./descendant::refProgram) &gt; 0">
       <xsl:apply-templates select="./refProgram">
         <xsl:with-param name="ident" select="$ident"/>
         <xsl:with-param name="_semestre" select="$_semestre"/>
       </xsl:apply-templates>
     </xsl:when>
     <xsl:when test="count(./descendant::refCourse) &gt; 0">
       <xsl:apply-templates select="./descendant::subBlock[refCourse]">
         <xsl:with-param name="_semestre" select="$_semestre"/>
       </xsl:apply-templates>
     </xsl:when>
   </xsl:choose>
  </xsl:template>
  <!--  -->
  <xsl:template match="refProgram">
    <xsl:param name="ident"/>
    <xsl:param name="_semestre"/>
    <xsl:param name="premUE"/>
    <!--    -->

    <xsl:variable name="ref" select="normalize-space(./@ref)"/>
    <xsl:if test="$debug = 1">
      <fo:block font-weight="bold" font-style="italic" color="#e22202">[template : refProgram ] ident = (<xsl:value-of select="$ident"/>) _semestre = (<xsl:value-of select="$_semestre"/>) premUE = (<xsl:value-of select="$premUE"/>) ref =(<xsl:value-of
          select="$ref"/>)</fo:block>
    </xsl:if> 
    <fo:block>
      <!-- break-before="page"   -->
      <xsl:if test="$debug = 1">
        <fo:block> Semestre <xsl:value-of select="position()"/></fo:block> (saut de page) <fo:block font-weight="bold" font-style="italic" color="#e22202">[template : vers course <xsl:value-of select="./@ref"/>]</fo:block>
      </xsl:if>
      <xsl:apply-templates select="//subProgram[@ident=$ref]">
        <xsl:with-param name="ref" select="$ref"/>
        <xsl:with-param name="_semestre" select="position()"/>
      </xsl:apply-templates>
    </fo:block>
  </xsl:template>
  <!--  -->
  <xsl:template match="subProgram">
    <xsl:param name="ref"/>
    <xsl:param name="_semestre"/>
    <fo:block>
      <xsl:if test="$debug = 1">
        <fo:block font-weight="bold" font-style="italic" color="#e22202">[template : match=subProgram ]  ref=(<xsl:value-of select="$ref"/>) Semestre <xsl:value-of select="position()"/></fo:block>
      </xsl:if>
      <!--  space-before.optimum="{$spaceBeforeTitre}mm" -->
      <fo:block text-decoration="underline" margin-left="4pt" font-weight="bold" space-before.optimum="{$spaceBeforeTitre2}mm" color="{$couleur}" font-size="{$tailleTitre4}pt">
        <xsl:variable name="titre">
          <xsl:apply-templates select="./programName/text">
            <xsl:with-param name="break" select="0"/>
          </xsl:apply-templates>
        </xsl:variable>
        <xsl:call-template name="afficheTitre_pdf">
          <xsl:with-param name="titre" select="$titre"/>
          <xsl:with-param name="niveau" select="4"/>
        </xsl:call-template>
      </fo:block>
    </fo:block>

    <xsl:if test="$debug = 1">
      <fo:block font-weight="bold">APPLICATION ./programStructure</fo:block>
    </xsl:if>

    <xsl:apply-templates select="./programStructure">
      <xsl:with-param name="ident" select="./@ident"/>
      <xsl:with-param name="_semestre" select="$_semestre"/>
      <!-- <xsl:with-param name="premUE" select=".//refCourse/@ref"/> -->
    </xsl:apply-templates>
    <xsl:if test="$debug = 1">
      <fo:block font-weight="bold"> FIN APPLICATION ./programStructure </fo:block>
    </xsl:if>
  </xsl:template>
  <!-- *************** FIN  TEMPLATES DANS program    *************** -->
  <!-- lien vers Ressource pédagogique 
	<xsl:template match="/CDM/program/webLink[@role='learningObjectMetadata']">
		<xsl:apply-templates select="href">
			<xsl:with-param name="navigationItem" select="$variablesExt/variables/navigationVar/navigationItem[@type='15']/value[@lang=$_lang]"/>
			<xsl:with-param name="linkTitle" select="$variablesExt/variables/navigationVar/linkTitle[@type='15']/value[@lang=$_lang]"/>
		</xsl:apply-templates>
	</xsl:template>
	<xsl:template match="href">
		<xsl:param name="navigationItem"/>
		<xsl:param name="linkTitle"/>
			<xsl:value-of select="$navigationItem"/>
	</xsl:template>
	-->
  <xsl:template match="/CDM/orgUnit/infoBlock[@userDefined='droiScol']">
    <xsl:param name="titre"/>
    <fo:block space-before.optimum="14pt" font-size="{$tailleTexte}pt">
      <xsl:call-template name="Titreheader_pdf">
        <xsl:with-param name="titre" select="$titre"/>
      </xsl:call-template>
      <xsl:call-template name="texteFormate_pdf"/>
    </fo:block>
  </xsl:template>
  <!-- *************** TEMPLATE GENERAUX  *************** -->
  <xsl:template match="adr">
    <fo:block>
    <xsl:value-of select="./pobox"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./extadr"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./street"/>
    </fo:block>
    <fo:block>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./pcode"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./locality"/>
    </fo:block>
    <fo:block>
    <xsl:text> </xsl:text>
    <xsl:value-of select="./country"/>
    </fo:block>
  </xsl:template>
  <!--  -->
  <xsl:template match="teachingActivity">
    <xsl:variable name="val" select="normalize-space(./infoBlock/header)"/>
    <xsl:if test="not($val= '')">
      <fo:block font-weight="bold" color="{$couleur}" font-size="{$tailleTitre5}pt" space-before.optimum="{spaceBeforeTitre}mm">
        <xsl:value-of select="./header"/><xsl:text> </xsl:text>
      </fo:block>
    </xsl:if>
      <fo:block margin-left="{$retraitTexte1}mm">
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='volumeHoraireCours']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='volumeHoraireTd']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='volumeHoraireTp']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='volumeHoraireTutorat']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='volumeHoraireCourstd']"/>
      </fo:block>

  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='volumeHoraireCours']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
     <xsl:text> </xsl:text>
    <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='volumeHoraireCours']/value[@lang=$_lang]"/>
    <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='volumeHoraireTd']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='volumeHoraireTd']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='volumeHoraireTp']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='volumeHoraireTp']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='volumeHoraireTutorat']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='volumeHoraireTutorat']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='volumeHoraireCourstd']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='volumeHoraireCourstd']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="exam">
    <xsl:variable name="val" select="normalize-space(./infoBlock/header)"/>
    <xsl:if test="not($val= '')">
      <fo:block font-weight="bold" color="{$couleur}" font-size="{$tailleTitre5}pt" space-before.optimum="{spaceBeforeTitre}mm">
        <xsl:value-of select="./header"/><xsl:text> </xsl:text>
      </fo:block>
    </xsl:if>
      <fo:block margin-left="{$retraitTexte1}mm">    
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='examensCc']"/>
        <xsl:apply-templates select="./infoBlocksubBlock[@userDefined='examensDs']"/>
        <xsl:apply-templates select="./infoBlocksubBlock[@userDefined='examensExa']"/>
        <xsl:apply-templates select="./infoBlocksubBlock[@userDefined='examensOral']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='examensTp']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='examensDuree1']"/>
        <xsl:apply-templates select="./infoBlock/subBlock[@userDefined='examensDuree2']"/>
    </fo:block>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensCc']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensCc']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensDs']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensDs']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensExa']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensExa']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensOral']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensOral']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensTp']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensTp']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensDuree1']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensDuree1']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensDuree2']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensDuree2']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="subBlock[@userDefined='examensCc']">
    <xsl:variable name="val" select="normalize-space(.)"/>
    <xsl:if test="not($val = '') and not($val = 0)">
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/userDefine[@type='examensCc']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$val"/><xsl:text>  H</xsl:text>
    </xsl:if>
  </xsl:template>
  
  <!--  -->
  <xsl:template match="infoBlock">
    <xsl:if test="not(normalize-space(./header) = '')">
      <fo:block font-weight="bold" color="{$couleur}" font-size="{$tailleTitre5}pt" space-before.optimum="{spaceBeforeTitre}mm">
        <xsl:value-of select="./header"/>
      </fo:block>
    </xsl:if>
    <!-- ATTENTION, rajouter ici le traitement des subBlock particuliers -->
    <fo:block margin-left="{$retraitTexte1}mm">
    <xsl:apply-templates select="./subBlock[@userDefined='pdf']"/>
    </fo:block>

    
    
    
    
    
  </xsl:template>
  <!-- A revoir en attente 
	<xsl:template match="/CDM/program/infoBlock/subBlock[header='Matières dominantes']">
		<xsl:variable name="leTitre">
			<xsl:choose>
				<xsl:when test="not($variablesExt/variables/titreVar/titreRub[@type='12']/value[@lang=$_lang]]='')">
					<xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='12']/value[@lang=$_lang]"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="./header"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:call-template name="Titreheader_pdf">
			<xsl:with-param name="titre" select="$leTitre"/>
		</xsl:call-template>
		<xsl:call-template name="texteFormate_pdf"/>
	</xsl:template>
	-->
  <!--  -->
  <xsl:template match="regulations">
    <!-- lien vers le reglement -->
    <xsl:apply-templates select="node()"/>
  </xsl:template>
  <!--  -->
  <!-- ******************** TEMPLATES nommes******************** -->
  <xsl:template name="tableau">
    <!-- template recursif pour afficher le thermometre -->
    <xsl:param name="valCreditECTS"/>
    <xsl:param name="creditRequis"/>
    <xsl:param name="total"/>
    <!-- nr indique que la valeur n'est pas renseignée dans CDM -->
    <xsl:if test="not($creditRequis = 'nr')">
      <xsl:variable name="valFin" select="$creditRequis + $valCreditECTS"/>
      <xsl:choose>
        <xsl:when test="(($total &gt;= $creditRequis) and ($total &lt; $valFin))">
          <fo:external-graphic src="{$baseMediaPdf}/pictos/carre44{$typeFormation}.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:call-template name="tableau">
            <xsl:with-param name="valCreditECTS">
              <xsl:value-of select="$valCreditECTS"/>
            </xsl:with-param>
            <xsl:with-param name="creditRequis">
              <xsl:value-of select="$creditRequis"/>
            </xsl:with-param>
            <xsl:with-param name="total">
              <xsl:value-of select="$total+30"/>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="$total &lt; number($creditRequis)">
          <fo:external-graphic src="{$baseMediaPdf}/pictos/carreSem.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:call-template name="tableau">
            <xsl:with-param name="valCreditECTS">
              <xsl:value-of select="$valCreditECTS"/>
            </xsl:with-param>
            <xsl:with-param name="creditRequis">
              <xsl:value-of select="$creditRequis"/>
            </xsl:with-param>
            <xsl:with-param name="total">
              <xsl:value-of select="$total+30"/>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="(($total &lt; 480))">
          <fo:external-graphic src="{$baseMediaPdf}/pictos/carreSem.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:call-template name="tableau">
            <xsl:with-param name="valCreditECTS">
              <xsl:value-of select="$valCreditECTS"/>
            </xsl:with-param>
            <xsl:with-param name="creditRequis">
              <xsl:value-of select="$creditRequis"/>
            </xsl:with-param>
            <xsl:with-param name="total">
              <xsl:value-of select="$total+30"/>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:when>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!-- EN ATTENTE ce template a besoin du referenciel des constantes TEMPLATE A VERIFIER -->
  <xsl:template name="Sel_metiers">
    <xsl:param name="selected"/>
    <xsl:param name="nombre"/>
    <xsl:variable name="dom">Dominante</xsl:variable>
    <xsl:variable name="espace">
      <xsl:text> </xsl:text>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$nombre=3"/>
      <xsl:otherwise>
        <!-- 
				<xsl:variable name="dom" select="concat($dom,string($nombre))"/>
				<xsl:variable name="nombre" select="($nombre)+1"/>
				<xsl:variable name="contiend" select="contains($selected,' ')"/>
				 -->
        <!-- 
				<xsl:variable name="maselection">
					<xsl:choose>
						<xsl:when test="$contiend='true'">
							<xsl:value-of select="substring-before($selected,string($espace))"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$selected"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				 -->
        <!-- retire avant le premier espace  -->
        <!-- 
				<xsl:variable name="retire" select="concat($maselection,string($espace))"/>
				 -->
        <!-- retire la premiere chaine -->
        <!-- 
				<xsl:variable name="reste">
					<xsl:value-of select="substring-after($selected,$retire)"/>
				</xsl:variable>
				 -->
        <!--   <xsl:value-of select="$nombre"/>: <select name="formation/objectifs/debouche/@rome" size="1">
                    <option>
                        <xsl:attribute name="value"/>
                </option>-->
        <!--  
				<xsl:for-each select="./CONSTANTE_A DEFINIR/xxx">
					<xsl:choose>
						<xsl:when test="contains($maselection,./@rome)">
							<a target="_blank">
								<xsl:attribute name="href">http://rome.anpe.net/candidat/?url=fiche_rome.php&amp;rome=<xsl:value-of
									select="substring-after(./@rome,'rom-')"/></xsl:attribute>
								<xsl:attribute name="onClick">return
									nleFenetre('http://rome.anpe.net/candidat/?url=fiche_rome.php&amp;rome=<xsl:value-of
										select="substring-after(./@rome,'rom-')"/>')</xsl:attribute>
								<xsl:value-of select="./value[@lang='fr-FR']"/>
							</a>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
		
				-->
        <!-- <xsl:if test="not($reste='')"> -->
        <!-- 
				<xsl:if test="not($nombre='3')">
					<xsl:call-template name="Sel_metiers">
						<xsl:with-param name="selected">
							<xsl:value-of select="$reste"/>
						</xsl:with-param>
						<xsl:with-param name="nombre">
							<xsl:value-of select="$nombre"/>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
				 -->
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--  -->
  <!-- pour pdf de commun -->
  <xsl:template name="Titreheader_pdf">
    <xsl:param name="titre"/>
    <xsl:param name="niveau"/>
    <xsl:if test="count(.//text()[string-length(normalize-space(.)) &gt; 0]|subBlock|refCourse|refProgram|refOrgUnit)!=0 or $variablesExt/variables/affichageVar/optionAffichage[@type='rubriqueVide']/@value!=0">
      <xsl:choose>
        <xsl:when test="count(header)=0">
          <xsl:call-template name="afficheTitre_pdf">
            <xsl:with-param name="titre" select="$titre"/>
            <xsl:with-param name="niveau" select="$niveau"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="header">
            <xsl:with-param name="titre" select="$titre"/>
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template name="titreTexte">
    <xsl:param name="titre"/>
    <xsl:choose>
      <xsl:when test="not($titre='')">
        <xsl:value-of select="$titre"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="header"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- -->
  <xsl:template name="afficheTitre_pdf">
    <xsl:param name="titre"/>
    <xsl:param name="niveau"/>
    <xsl:if test="$debug = 1">(afficheTitre_pdf tailleTitre= <xsl:value-of select="$niveau"/>) </xsl:if>
    <xsl:choose>
      <xsl:when test="$niveau = 3">
        <fo:block space-before.optimum="{$spaceBeforeTitre}mm" font-weight="bold" color="{$couleur}" font-size="{$tailleTitre3}pt">
          <fo:external-graphic src="{$baseMediaPdf}/pictos/carre44{$typeFormation}.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:text> </xsl:text>
          <xsl:call-template name="titreTexte">
            <xsl:with-param name="titre" select="$titre"/>
          </xsl:call-template>
        </fo:block>
      </xsl:when>
      <xsl:when test="$niveau = 4">
        <!-- space-before.optimum="{$spaceBeforeTitre}mm" -->
        <fo:block text-decoration="underline" margin-left="4pt" font-weight="bold" color="{$couleur}" font-size="{$tailleTitre4}pt">
          <xsl:call-template name="titreTexte">
            <xsl:with-param name="titre" select="$titre"/>
          </xsl:call-template>
        </fo:block>
      </xsl:when>
      <xsl:when test="$niveau = 5">
        <fo:block space-before.optimum="{$spaceBeforeTitre}mm" font-weight="bold" color="{$couleur}" font-size="{$tailleTitre5}pt">
          <xsl:call-template name="titreTexte">
            <xsl:with-param name="titre" select="$titre"/>
          </xsl:call-template>
        </fo:block>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- -->
  <xsl:template name="texteFormate_pdf">
    <xsl:param name="titre"/>
    <xsl:if test="count(text()[string-length(normalize-space(.)) &gt; 0]|subBlock|refCourse|refProgram|refOrgUnit)!=0 or $variablesExt/variables/affichageVar/optionAffichage[@type='rubriqueVide']/@value!=0">
      <fo:block space-before.optimum="{$distancEntreParag}mm" font-size="{$tailleTexte}pt">
        <xsl:apply-templates select="text() | *[not(name()='header')]">
          <xsl:with-param name="titre" select="$titre"/>
        </xsl:apply-templates>
      </fo:block>
      <!-- width="460" height="3" -->
      <fo:external-graphic src="{$baseMediaPdf}/trait.gif" scaling="non-uniform" alignment-adjust="0%"/>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template name="listeSubProgram">
    <fo:list-block margin-left="1.5cm" provisional-label-separation="5.5cm" provisional-distance-between-starts="1.5cm">
      <xsl:for-each select="/CDM/program[not(position()=1) and not(./@ident=$_oid) ]">
        <fo:list-item>
          <fo:list-item-label>
            <fo:block/>
          </fo:list-item-label>
          <fo:list-item-body>
            <fo:block font-style="italic">
              <fo:external-graphic src="{$baseMediaPdf}/pictos/puc_list.gif" scaling="non-uniform" alignment-adjust="0%"/>
              <xsl:text>   </xsl:text>
              <xsl:apply-templates select="./programName/text">
                <xsl:with-param name="break" select="0"/>
              </xsl:apply-templates>
            </fo:block>
          </fo:list-item-body>
        </fo:list-item>
      </xsl:for-each>
    </fo:list-block>
  </xsl:template>
  <!-- template  de zonelien.xsl -->
  <xsl:template name="logo">
    <fo:block>
      <fo:external-graphic src="{$baseMediaPdf}/images/{$variablesExt/variables/affichageVar/optionAffichage[@type='logo']/@select}"/>
    </fo:block>
  </xsl:template>
<!--  -->
  <xsl:template name="traitdate">
    <xsl:param name="date"/>
    <xsl:variable name="long">
      <xsl:value-of select="string-length($date)-5"/>
    </xsl:variable>
    <xsl:variable name="tail">
      <xsl:value-of select="substring($date , 5 ,$long)"/>
    </xsl:variable>
    <xsl:variable name="temp">
      <xsl:value-of select="substring($date , 6 ,$long)"/>
    </xsl:variable>
    <xsl:variable name="annee">
      <xsl:value-of select="substring-before($date , $tail)"/>
    </xsl:variable>
    <xsl:variable name="mois">
      <xsl:choose>
        <xsl:when test="string-length($temp)=5">
          <xsl:value-of select="substring($temp , 1,2)"/>
        </xsl:when>
        <xsl:otherwise>01</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="jour">
      <xsl:choose>
        <xsl:when test="string-length($temp)=5">
          <xsl:value-of select="substring($temp , 4 ,2)"/>
        </xsl:when>
        <xsl:otherwise>01</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="lemois">
      <xsl:choose>
        <xsl:when test="number($mois)=1">Janvier</xsl:when>
        <xsl:when test="number($mois)=2">Février</xsl:when>
        <xsl:when test="number($mois)=3">Mars</xsl:when>
        <xsl:when test="number($mois)=4">Avril</xsl:when>
        <xsl:when test="number($mois)=5">Mai</xsl:when>
        <xsl:when test="number($mois)=6">Juin</xsl:when>
        <xsl:when test="number($mois)=7">Juillet</xsl:when>
        <xsl:when test="number($mois)=8">Août</xsl:when>
        <xsl:when test="number($mois)=9">Septembre</xsl:when>
        <xsl:when test="number($mois)=10">Octobre</xsl:when>
        <xsl:when test="number($mois)=11">Novembre</xsl:when>
        <xsl:when test="number($mois)=12">Décembre</xsl:when>
      </xsl:choose>
    </xsl:variable> le <xsl:value-of select="$jour"/>
    <xsl:text>  </xsl:text>
    <xsl:value-of select="$lemois"/>
    <xsl:text>  </xsl:text>
    <xsl:value-of select="$annee"/>
  </xsl:template>
  <!--  -->
  <xsl:template name="section">
    <xsl:param name="titre"/>
    <xsl:param name="node"/>
    <!-- ajout condition  0505 pr eviter une cellule vide pr validation xml-->
    <xsl:variable name="compter" select="count($node/subBlock[@blockLang=$_lang or not(@blockLang)])"/>
    <xsl:if test="$compter &gt; 0">
      <fo:table table-layout="fixed" width="100%">
        <fo:table-column column-width="proportional-column-width(1)"/>
        <fo:table-body>
          <fo:table-row keep-with-next="auto">
            <fo:table-cell>
              <fo:block space-before.optimum="{$spaceBeforeTitre}mm" font-size="{$tailleTitre3}pt" keep-together="always">
                <!-- image -->
                <fo:external-graphic src="{$baseMediaPdf}/pictos/carre44{$typeFormation}.gif" scaling="non-uniform" alignment-adjust="0%"/>
                <xsl:text> </xsl:text>
                <xsl:choose>
                  <xsl:when test="$node/header">
                    <fo:wrapper font-weight="bold" color="{$couleur}">
                      <xsl:value-of select="$node/header"/>
                    </fo:wrapper>
                  </xsl:when>
                  <xsl:otherwise>
                    <fo:wrapper font-weight="bold" color="{$couleur}">
                      <xsl:value-of select="$titre"/>
                    </fo:wrapper>
                  </xsl:otherwise>
                </xsl:choose>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
          <fo:table-row>
            <fo:table-cell>
              <!-- ajout condition  0505 pr eviter une cellule vide pr validation xml
                <xsl:variable name="compter" select="count($node/subBlock[@blockLang=$_lang or not(@blockLang)])"/>
                <xsl:if test="$compter = 0"><fo:block><xsl:text> </xsl:text></fo:block></xsl:if>-->
              <xsl:for-each select="$node/subBlock[@blockLang=$_lang or not(@blockLang)]">
                <fo:block space-before.optimum="{$distancEntreParag}mm" text-align="justify" text-indent="4mm" font-family="Arial" font-size="{$tailleTexte}pt">
                  <xsl:apply-templates select="."/>
                </fo:block>
              </xsl:for-each>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </xsl:if>
  </xsl:template>
<!--  -->
  <xsl:template match="course">
<!-- AFFICHAGE DE L UE COMPLETE -->
    <!-- Titre de l UE -->
    <xsl:apply-templates select="./courseName/text[@language=$_lang or not(@language)]">
      <xsl:with-param name="taille-Texte" select="$variablesExt/variables/contentpdfvar/formatage/tailleTitre6/@select"/>
    </xsl:apply-templates>

    <!-- Texte  explicatif  nbre de credits -->
    <fo:block>
      <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='11']/value[@lang=$_lang]"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="ceiling(./credits/@ECTScredits)"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/courseVar/header[@type='5']/value[@lang=$_lang]"/>
      <xsl:if test="ceiling(./credits/@ECTScredits)&gt;0">s</xsl:if>
    </fo:block>
    <!-- FIN Texte  explicatif -->
    <xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@type='courseResume']/@value = '1'">
      <fo:block>
        <xsl:apply-templates select="./teachingActivity"/>
        <xsl:apply-templates select="./exam"/>
      </fo:block>
    </xsl:if>
    <!--fin tableau haut -->
    <!-- Non traité
      codeSise
      <xsl:value-of select="/catalogueLocal/fragment[@type='ue' and @oid=$_oid]/contenus/ue/codeSise"/>
      domaineLocal
      <xsl:value-of select="/catalogueLocal/fragment[@type='ue' and @oid=$_oid]/contenus/ue/domaineLocal"/>
      ufr==<xsl:value-of select="/catalogueLocal/fragment[@type='ue' and @oid=$_oid]/contenus/ue/ufr"/>
    -->
    <fo:block>
      <xsl:apply-templates select="./courseDescription"/>
    </fo:block>
    <fo:block>
      <xsl:apply-templates select="./recommendedPrerequisites"/>
    </fo:block>
    <fo:block>
      <xsl:apply-templates select="./learningObjectives"/>
    </fo:block>
    <fo:block>
      <xsl:apply-templates select="./formalPrerequisites"/>
    </fo:block>
    <fo:block>
        <xsl:value-of select="$variablesExt/variables/courseVar/header[@type=8]/value[@lang=$_lang]"/>
    </fo:block>
    <xsl:apply-templates select="./contacts"/>
  </xsl:template>
  <!--  -->
  <xsl:template match="teachingPlace">
    <xsl:if test="not(normalize-space(.)) = ''">
      <fo:block margin-left="{$retraitTexte1}mm">
        <fo:wrapper font-weight="bold">
          <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='26']/value[@lang=$_lang]"/>
          <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='8']/value[@lang=$_lang]"/>
        </fo:wrapper>
        <xsl:value-of select="."/>
      </fo:block>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="contacts">
    <xsl:apply-templates select="person | refPerson"/>
  </xsl:template>
  <!--  -->
  <xsl:template match="refPerson">
    <xsl:variable name="ref" select="@ref"/>
JE TESTE CA
    <xsl:apply-templates select="/CDM/person[@ident=$ref]">
      <xsl:with-param name="role" select="@role"/>
    </xsl:apply-templates>
  </xsl:template>
  <!--  -->
  <xsl:template match="person">
    <xsl:param name="role"/>
blblb
    <xsl:variable name="leRole">
      <xsl:choose>
        <xsl:when test="not(normalize-space(./role) = '')">
          <xsl:value-of select="./role"/>
          <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='8']/value[@lang=$_lang]"/>
        </xsl:when>
        <xsl:when test="not($role = '')">
          <xsl:value-of select="$role"/>
          <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='8']/value[@lang=$_lang]"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <fo:block space-after="{$variablesExt/variables/contentpdfvar/formatage/distancEntreContacts/@select}mm">
      <!-- pas de role si pas de nom  -->
      <xsl:if test="not(normalize-space(./name/family)) = ''">
        <fo:wrapper font-weight="bold">
          <xsl:value-of select="$leRole"/>
        </fo:wrapper>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="not($variablesExt/variables/affichageVar/optionAffichage[@type=$leRole]/@adress=0)">
          <!-- adresse -->
          <xsl:apply-templates select="./contactData"/>
        </xsl:when>
        <xsl:otherwise>
          <!-- pas adresse -->
          <xsl:value-of select="./name/family"/><xsl:text>  </xsl:text><xsl:value-of select="./name/given"/>
        </xsl:otherwise>
      </xsl:choose>
    </fo:block>
  </xsl:template>
  <!--  -->
  <xsl:template match="contactData">
    <!-- Traitement mail vide -->
    <xsl:value-of select="../name/family"/><xsl:text>  </xsl:text><xsl:value-of select="../name/given"/>
    <xsl:choose>
      <xsl:when test="not(./email='')">
        <fo:block>
          <fo:external-graphic src="{$baseMediaPdf}/pictos/mail.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="./email"/>
        </fo:block>
      </xsl:when>
    </xsl:choose>
    <!-- Traitement telephone et Fax vide -->
    <xsl:if test="not(normalize-space(./telephone)='')">
      <fo:block>
        <fo:external-graphic src="{$baseMediaPdf}/pictos/phone.gif" scaling="non-uniform" alignment-adjust="0%"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="./telephone"/>
      </fo:block>
    </xsl:if>
    <xsl:if test="not(normalize-space(./fax)='')">
      <fo:block>
        <fo:external-graphic src="{$baseMediaPdf}/pictos/fax.gif" scaling="non-uniform" alignment-adjust="0%"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="./fax"/>
      </fo:block>
    </xsl:if>
    <xsl:apply-templates select="./adr/extadr"/>
  </xsl:template>
  <!--  -->
  <xsl:template match="extadr">
    <xsl:variable name="compter" select="count(./subBlock[@blockLang=$_lang or not(@blockLang)])"/>
    <xsl:if test="$compter &gt; 0">
      <fo:block>
        <fo:wrapper font-weight="bold">
          <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='7']/value[@lang=$_lang]"/>
          <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='8']/value[@lang=$_lang]"/>
        </fo:wrapper>
        <xsl:value-of select="."/>
      </fo:block>
    </xsl:if>
  </xsl:template>
  <!--  -->
  <xsl:template match="email">
    <xsl:variable name="value" select="normalize-space(.)"/>
    <fo:basic-link external-destination="url(concat('mailto:' , $value))" text-decoration="underline" color="{$variablesExt/variables/contentpdfvar/couleurLiens/@color}">
      <fo:wrapper>
        <xsl:value-of select="."/>
      </fo:wrapper>
    </fo:basic-link>
  </xsl:template>
  <!--  -->
  <xsl:template match="webLink">
    <xsl:variable name="http" select="normalize-space(./href)"/>
    <xsl:choose>
      <xsl:when test="not($http='')">
        <xsl:call-template name="liensuRL"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!--  -->
  <xsl:template name="liensuRL">
    <xsl:variable name="linkName" select="normalize-space(./linkName)"/>
    <xsl:variable name="intitule">
      <xsl:choose>
        <xsl:when test="not($linkName = '')">
          <xsl:value-of select="$linkName"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:choose>
            <xsl:when test="./@role='homepage'">
             <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='9']/value[@lang=$_lang]"/>
            </xsl:when>
          </xsl:choose>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:value-of select="$variablesExt/variables/contentpdfvar/content[@type='8']/value[@lang=$_lang]"/>
    </xsl:variable>
    <xsl:variable name="href">
      <xsl:apply-templates select="href"/>
    </xsl:variable>
    <fo:wrapper font-weight="bold">
      <xsl:value-of select="$intitule"/>
    </fo:wrapper>
    <fo:basic-link external-destination="url({$href})" text-decoration="underline" color="{$variablesExt/variables/contentpdfvar/couleurLiens/@color}">
      <fo:wrapper>
        <xsl:value-of select="$href"/>
      </fo:wrapper>
    </fo:basic-link>
  </xsl:template>
  <!--  -->
  <xsl:template match="href">
    <xsl:value-of select="normalize-space(.)"/>
  </xsl:template>
  <!-- template de présentation -->
  <xsl:template match="list">
    <fo:list-block margin-left="2cm" provisional-label-separation="5mm" provisional-distance-between-starts="15mm">
      <xsl:apply-templates select="listItem"/>
    </fo:list-block>
  </xsl:template>
  <!--  -->
  <xsl:template match="listItem">
    <fo:list-item line-height="6mm">
      <fo:list-item-label>
        <fo:block/>
      </fo:list-item-label>
      <fo:list-item-body>
        <fo:block>
          <!--  
          <xsl:choose>
            <xsl:when test="../list/@listType = 'bulleted'">
              
            </xsl:when>
            <xsl:otherwise/>
          </xsl:choose>
          -->
          <fo:external-graphic src="{$baseMediaPdf}/pictos/puc_list.gif" scaling="non-uniform" alignment-adjust="0%"/>
          <xsl:text>  </xsl:text>
          <xsl:apply-templates select="node()"/>
        </fo:block>
      </fo:list-item-body>
    </fo:list-item>
  </xsl:template>
  <!--  -->
  <xsl:template match="picture"/>
  <!--  -->
  <xsl:template match="text">
    <xsl:param name="taille-Texte"/>
    <xsl:param name="text-align"/>
    <xsl:param name="niveau"/>
    <xsl:param name="break"/>
    <xsl:variable name="align">
      <xsl:choose>
        <xsl:when test="$text-align =''">
          <xsl:value-of select="'left'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$text-align"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="taille">
      <xsl:choose>
        <xsl:when test="$taille-Texte =''">
          <xsl:value-of select="$tailleTexte"/>pt </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$taille-Texte"/>pt </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$break ='0'">
        <xsl:apply-templates select="node()"/>
        <xsl:text> </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <fo:block font-size="{$taille}" text-align="{$align}">
          <!-- <xsl:value-of select="."/> -->
          <xsl:apply-templates select="node()"/>
        </fo:block>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
<!--  -->
  <xsl:template match="italic">
    <fo:wrapper font-style="italic">
      <xsl:apply-templates select="node()"/>
    </fo:wrapper>
  </xsl:template>
  <xsl:template match="bold">
    <fo:wrapper font-weight="bold">
      <xsl:apply-templates select="node()"/>
    </fo:wrapper>
  </xsl:template>
<!--  -->
</xsl:stylesheet>
