<xsl:stylesheet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">

	<!--
			Constantes
	-->
    <xsl:param name="nomenclatureStartStr">Nomenclature :</xsl:param>
    <xsl:param name="nomenclatureEndStr">Fin de la nomenclature</xsl:param>
    <xsl:param name="undefinedLabel">UNDEFINED</xsl:param>

	<!-- 
			Valeurs des attributs /schema/annotation/documentation/@source 
			pour les variables dans OTT
	 -->
    <xsl:variable name="titreSchemeVarName">Titre</xsl:variable>
	<!--xsl:variable name="codeVarName">Code</xsl:variable-->
    <xsl:variable name="idSchemeVarName">Id</xsl:variable>
    <xsl:variable name="copyrightSchemeVarName">Copyright</xsl:variable>
    <xsl:variable name="descriptionSchemeVarName">Description</xsl:variable>
    <xsl:variable name="contributeurSchemeVarName">Contributeur</xsl:variable>
    <xsl:variable name="versionSchemeVarName">Version</xsl:variable>
    <xsl:variable name="themeSchemeVarName">Theme</xsl:variable>
    <xsl:variable name="couvertureSchemeVarName">Couverture</xsl:variable>
    <xsl:variable name="motCleSchemeVarName">MotCle</xsl:variable>
    <xsl:variable name="langSchemeVarName">Lang</xsl:variable>
    <xsl:variable name="dateCreationSchemeVarName">DateCreation</xsl:variable>
    <xsl:variable name="dateMAJSchemeVarName">DateMAJ</xsl:variable>
    <xsl:variable name="dateValidationSchemeVarName">DateValidation</xsl:variable>
    <xsl:variable name="statutDocSchemeVarName">StatutDoc</xsl:variable>
    <xsl:variable name="evolutionSchemeVarName">Evolution</xsl:variable>
    <xsl:variable name="domaineSchemeVarName">Domaine</xsl:variable>

	<!--
			Nom des variables dans OTT
	-->
    <xsl:variable name="titreODFVarName">Titre</xsl:variable>
    <xsl:variable name="themeODFVarName">Thème</xsl:variable>
    <xsl:variable name="versionODFVarName">VersionDoc</xsl:variable>
    <xsl:variable name="motCleODFVarName">MotsClés</xsl:variable>
    <xsl:variable name="descriptionODFVarName">DescriptionDocument</xsl:variable>
    <xsl:variable name="contributeurODFVarName">ListeGroupes</xsl:variable>
    <xsl:variable name="dateCreationODFVarName">DateCréation</xsl:variable>
    <xsl:variable name="dateMAJODFVarName">DateModification</xsl:variable>
    <xsl:variable name="dateValidationODFVarName">DateValidation</xsl:variable>
    <xsl:variable name="formatDocODFVarName">FormatDoc</xsl:variable>
    <xsl:variable name="idODFVarName">IdentifiantUnique</xsl:variable>
    <xsl:variable name="langODFVarName">Langue</xsl:variable>
    <xsl:variable name="couvertureODFVarName">Couverture</xsl:variable>
    <xsl:variable name="copyrightODFVarName">AnnéeCopyrightSandre</xsl:variable>
    <xsl:variable name="statutDocODFVarName">StatutDoc</xsl:variable>
    <xsl:variable name="domaineDocODFVarName">Domaine</xsl:variable>	

	<!--
			Valeur des formats d'un attribut
	-->
    <xsl:variable name="texteFormat">Texte</xsl:variable>
    <xsl:variable name="charactersFormat">Caractère</xsl:variable>
    <xsl:variable name="numericFormat">Numérique</xsl:variable>
    <xsl:variable name="dateFormat">Date</xsl:variable>
    <xsl:variable name="timeFormat">Heure</xsl:variable>
    <xsl:variable name="dateTimeFormat">Date et heure</xsl:variable>
    <xsl:variable name="indicatorFormat">Booléen</xsl:variable>
    <xsl:variable name="binaryFormat">Binaire</xsl:variable>
	
	<!-- Tableau des évolutions des dictionnaire des données et des scenarii d'échanges -->
    <xsl:variable name="evolutionsHeader">Evolutions</xsl:variable>

		<!-- Nom du style pour le tableau des évolutions du dictionnaire des données -->
	<!-- ATTENTION la table est la même pour les 2 types de documents Scenario/Dictionnaire -->
    <xsl:variable name="evolutionsTableStyleName">Table1</xsl:variable>

		<!-- Nom du style pour les colonnes du évolutions des CodeType du dictionnaire des données -->
    <xsl:variable name="evolutionsTableColumnStyleNameA">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.A')"/>
    </xsl:variable>
    <xsl:variable name="evolutionsTableColumnStyleNameB">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.B')"/>
    </xsl:variable>
		
		<!-- Nom du style pour les colonnes du évolutions des CodeType du dictionnaire des données -->
    <xsl:variable name="evolutionsTableRowStyleName1">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.1')"/>
    </xsl:variable>
    <xsl:variable name="evolutionsTableRowStyleName2">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.2')"/>
    </xsl:variable>	
	
		<!-- Nom du style pour les cellules du header du tableau des évolutions du dictionnaire des données-->
    <xsl:variable name="evolutionsTableHeaderCellStyleName">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.A1')"/>
    </xsl:variable>

	<!-- Nom du style pour les header du tableau des évolutions du dictionnaire des données -->
	<!-- ATTENTION les styles de paragraphes P18... sont différents entre Scenario/Dictionnaire -->
    <xsl:variable name="evolutionsTableHeaderTextStyleName">Standard</xsl:variable>
	
		<!-- Nom du style pour les cellules du tableau des évolutions du dictionnaire des données -->
    <xsl:variable name="evolutionsTableCellStyleName1">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.A1')"/>
    </xsl:variable>
    <xsl:variable name="evolutionsTableCellStyleNameA">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.A2')"/>
    </xsl:variable>
    <xsl:variable name="evolutionsTableCellStyleNameB">
        <xsl:value-of select="concat($evolutionsTableStyleName,'.B2')"/>
    </xsl:variable>		
	
	<!-- Nom du style pour le texte des cellules du tableau évolutions du dictionnaire des données -->
	<!-- ATTENTION les styles de paragraphes P18... sont différents entre Scenario/Dictionnaire -->
    <xsl:variable name="evolutionsTableTextStyleName1">Standard</xsl:variable>
    <xsl:variable name="evolutionsTableTextStyleNameA">Standard</xsl:variable>
    <xsl:variable name="evolutionsTableTextStyleNameB">Standard</xsl:variable>
    <xsl:variable name="evolutionSeparator">|</xsl:variable>

	<!-- 
		AFFICHAGE DES EVOLUTIONS
	-->
    <xsl:template name="displayEvolutions">
        <xsl:param name="evolutions"/>
        <text:p/>
		
		<!--xsl:call-template name="displayLog">
			<xsl:with-param name="logContent"><xsl:value-of select="concat('Separator : ',$evolutionSeparator)"/></xsl:with-param>
		</xsl:call-template-->
        <table:table table:style-name="{$evolutionsTableStyleName}">
            <table:table-column table:style-name="${evolutionsTableColumnStyleNameA}"/>
            <table:table-column table:style-name="${evolutionsTableColumnStyleNameB}"/> 		  
<!-- 		
		<table:table-header-rows>
				<table:table-row>
					 <table:table-cell table:style-name="{$evolutionsTableHeaderCellStyleName}" office:value-type="string">
						<text:p text:style-name="{$evolutionsTableHeaderTextStyleName}"><xsl:value-of select="$evolutionsHeader"/></text:p> 
					</table:table-cell>
				</table:table-row>
		</table:table-header-rows>
 -->
            <xsl:for-each select="$evolutions">	
		
		<!--xsl:call-template name="displayLog">
			<xsl:with-param name="logContent"><xsl:value-of select="concat('displayEvolutions : ',.)"/></xsl:with-param>
		</xsl:call-template-->
                <xsl:variable name="evolution1" select="substring-before(., $evolutionSeparator)"/>
                <xsl:variable name="evolutionA" select="substring-before(substring-after(., $evolutionSeparator), $evolutionSeparator)"/>
                <xsl:variable name="evolutionB" select="substring-after(substring-after(., $evolutionSeparator), $evolutionSeparator)"/>
                <table:table-row table:style-name="{$evolutionsTableRowStyleName1}">
                    <table:table-cell table:style-name="{$evolutionsTableCellStyleName1}" table:number-columns-spanned="2" office:value-type="string">
                        <text:p text:style-name="${evolutionsTableTextStyleName1}">
                            <xsl:value-of select="$evolution1"/>
                        </text:p>
                    </table:table-cell>
                    <table:covered-table-cell/>
                </table:table-row>
                <table:table-row table:style-name="{$evolutionsTableRowStyleName1}">
                    <table:table-cell table:style-name="{$evolutionsTableCellStyleNameA}" office:value-type="string">
                        <text:p text:style-name="${evolutionsTableTextStyleNameA}">
                            <xsl:value-of select="$evolutionA"/>
                        </text:p>
                    </table:table-cell>
                    <table:table-cell table:style-name="{$evolutionsTableCellStyleNameB}" office:value-type="string">
                        <text:p text:style-name="${evolutionsTableTextStyleNameB}">
                            <xsl:value-of select="$evolutionB"/>
                        </text:p>
                    </table:table-cell>
                </table:table-row>
            </xsl:for-each>
        </table:table>
        <text:p/>
    </xsl:template>

	<!-- 
		AFFICHAGE D'UN LOG DE NIVEAU INFO
	-->
    <xsl:template name="displayLog">
        <xsl:param name="logContent"/>
        <log level="INFO">
            <xsl:value-of select="$logContent"/>
        </log>
    </xsl:template>

	<!-- 
		AFFICHAGE D'UN LOG DE NIVEAU ERROR
	-->
    <xsl:template name="displayLogError">
        <xsl:param name="logContent"/>
        <log level="ERROR">
            <xsl:value-of select="$logContent"/>
        </log>
    </xsl:template>

	<!-- 
		AFFICHAGE D'UN LOG DE NIVEAU WARNING
	-->
    <xsl:template name="displayLogWarning">
        <xsl:param name="logContent"/>
        <log level="WARNING">
            <xsl:value-of select="$logContent"/>
        </log>
    </xsl:template>

	<!-- 
		TRAITEMENT DES VARIABLES UTILISATEUR
	-->
    <xsl:template name="computeTemplateVariables">
        <xsl:param name="annotation"/>

			<!-- Titre -->
        <xsl:variable name="titre" select="$annotation/child::*[@source=$titreSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($titre) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Le titre ne peut être résolu (élément schema/annotation/documentation/@source=', $titreSchemeVarName, ' absent)')"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$titreODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$titreODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$titre"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Theme -->
        <xsl:variable name="theme" select="$annotation/child::*[@source=$themeSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($theme) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Le thème ne peut être résolu (élément schema/annotation/documentation/@source=', $themeSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$themeODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$themeODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$theme"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Version -->
        <xsl:variable name="version" select="$annotation/child::*[@source=$versionSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($version) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La version ne peut être résolue (élément schema/annotation/documentation/@source=', $versionSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$versionODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$versionODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$version"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Mot clés -->
        <xsl:variable name="motCle" select="$annotation/child::*[@source=$motCleSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($motCle) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Les mots clés ne peuvent être résolus (élément schema/annotation/documentation/@source=', $motCleSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$motCleODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$motCleODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$motCle"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Description -->
        <xsl:variable name="description" select="$annotation/child::*[@source=$descriptionSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($description) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La description ne peut être résolue (élément schema/annotation/documentation/@source=', $descriptionSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$descriptionODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$descriptionODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$description"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Contributeur -->
        <xsl:variable name="contributeur" select="$annotation/child::*[@source=$contributeurSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($contributeur) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Les contributeurs ne peuvent être résolus (élément schema/annotation/documentation/@source=', $contributeurSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$contributeurODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$contributeurODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$contributeur"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Date création -->
        <xsl:variable name="dateCreation" select="$annotation/child::*[@source=$dateCreationSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($dateCreation) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La date de création ne peut être résolue (élément schema/annotation/documentation/@source=', $dateCreationSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateCreationODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>l</xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateCreationODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$dateCreation"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Date de modification -->
        <xsl:variable name="dateModification" select="$annotation/child::*[@source=$dateMAJSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($dateModification) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La date de modification ne peut être résolue (élément schema/annotation/documentation/@source=', $dateMAJSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateMAJODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateMAJODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$dateModification"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Date de validation -->
        <xsl:variable name="dateValidation" select="$annotation/child::*[@source=$dateValidationSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($dateValidation) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La date de validation ne peut être résolue (élément schema/annotation/documentation/@source=', $dateValidationSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateValidationODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$dateValidationODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$dateValidation"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Format -->
        <xsl:call-template name="displayOneTemplateVariable">
            <xsl:with-param name="templateVarName" select="$formatDocODFVarName"/>
            <xsl:with-param name="templateVarValue">Open Document</xsl:with-param>
        </xsl:call-template>
			<!-- ID -->
        <xsl:variable name="id" select="$annotation/child::*[@source=$idSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($id) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('ID ne peut être résolu (élément schema/annotation/documentation/@source=', $idSchemeVarName, ' absent)' )"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$idSchemeVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$idSchemeVarName"/>
                    <xsl:with-param name="templateVarValue" select="$id"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Langue -->
        <xsl:variable name="lang" select="$annotation/child::*[@source=$langSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($lang) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La langue ne peut être résolue (élément schema/annotation/documentation/@source=', $langSchemeVarName, ' absent)') "/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$langODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$langODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$lang"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Couverture -->
        <xsl:variable name="couverture" select="$annotation/child::*[@source=$couvertureSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($couverture) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('La couverture ne peut être résolue (élément schema/annotation/documentation/@source=', $couvertureSchemeVarName, ' absent)') "/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$couvertureODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$couvertureODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$couverture"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
				<!-- Statut du document -->
        <xsl:variable name="statutDoc" select="$annotation/child::*[@source=$statutDocSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($statutDoc) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Le statut du document ne peut être résolu (élément schema/annotation/documentation/@source=', $statutDocSchemeVarName, ' absent)')"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$statutDocODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$statutDocODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$statutDoc"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Copyright -->
        <xsl:variable name="copyright" select="$annotation/child::*[@source=$copyrightSchemeVarName]"/>
        <xsl:choose>
            <xsl:when test="count($copyright) = 0 ">
                <xsl:call-template name="displayLogError">
                    <xsl:with-param name="logContent">
                        <xsl:value-of select="concat('Le copyright ne peut être résolu (élément schema/annotation/documentation/@source=', $copyrightSchemeVarName, ' absent)')"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$copyrightODFVarName"/>
                    <xsl:with-param name="templateVarValue">
                        <xsl:value-of select="$undefinedLabel"/>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="displayOneTemplateVariable">
                    <xsl:with-param name="templateVarName" select="$copyrightODFVarName"/>
                    <xsl:with-param name="templateVarValue" select="$copyright"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
			<!-- Domaine 
		<xsl:variable name="domaine" select="$annotation/child::*[@source=$domaineSchemeVarName]"/>
		<xsl:choose>
			<xsl:when test="count($domaine) = 0 ">
				<xsl:call-template name="displayLogError">
					<xsl:with-param name="logContent"><xsl:value-of select="concat('Le domaine ne peut être résolu (élément schema/annotation/documentation/@source=', $domaineSchemeVarName, ' absent)' )"/></xsl:with-param>
				</xsl:call-template>
				<xsl:call-template name="displayOneTemplateVariable">
					<xsl:with-param name="templateVarName" select="$domaineODFVarName"/>
					<xsl:with-param name="templateVarValue"><xsl:value-of select="$undefinedLabel"/></xsl:with-param>
				</xsl:call-template>					
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="displayOneTemplateVariable">
					<xsl:with-param name="templateVarName" select="$domaineODFVarName"/>
					<xsl:with-param name="templateVarValue" select="$domaine"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
		-->
    </xsl:template>

	<!-- 
		AFFICHAGE D'UNE VARIABLE UTILISATEUR
	-->
    <xsl:template name="displayOneTemplateVariable">
        <xsl:param name="templateVarName"/>
        <xsl:param name="templateVarValue"/>
        <text:user-field-decl office:value-type="string" office:string-value="{$templateVarValue}" text:name="{$templateVarName}"/>
    </xsl:template>

	<!-- 
		AFFICHAGE D'UNE IMAGE
	-->
    <xsl:template name="displayImage">
        <xsl:param name="imageFileName"/>
        <xsl:param name="imageName"/>
        <xsl:param name="prefixURL"/>
        <text:p/>
        <text:p/>
        <text:p text:style-name="{$imageParagraphStyleName}">
            <draw:frame draw:style-name="{$imageStyleName}" draw:name="{$imageName}" text:anchor-type="paragraph" draw:z-index="0">
                <draw:image xlink:href="{$prefixURL}{$imageFileName}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
            </draw:frame>
        </text:p>
    </xsl:template>

	<!-- 
		RECUPERATION D'UN NOM DE FICIHIER DANS UNE URL
	-->
    <xsl:template name="getFileName">
        <xsl:param name="path"/>
<!-- DEBUG	
<xsl:message>getFileName(<xsl:value-of select="$path" />)</xsl:message>
 -->
        <xsl:choose>
            <xsl:when test="contains($path, '/')">
                <xsl:call-template name="getFileName">
                    <xsl:with-param name="path" select="substring-after($path, '/')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="contains($path, '\')">
                <xsl:call-template name="getFileName">
                    <xsl:with-param name="path" select="substring-after($path, '\')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$path"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>