<xsl:stylesheet xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 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:open: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:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
		
	<!-- Préfixe des namespace externes à faire apparaître dans le tableau -->
    <xsl:variable name="sandreNsPrefixStartsWith">sa_</xsl:variable>	
	<!-- Libellé indiquant un élément obligatoire  -->
    <xsl:variable name="elementMandatoryCaracteristic">O</xsl:variable>
	<!-- Libellé indiquant un élément facultatif  -->
    <xsl:variable name="elementNotMandatoryCaracteristic">N</xsl:variable>
	<!-- Libellé pour un type non défini -->
    <xsl:variable name="defaultType">-</xsl:variable>
	<!-- Libellé pour un format non défini -->
    <xsl:variable name="defaultFormat">-</xsl:variable>
	<!-- Libellé pour une longueur maximum non définie -->
    <xsl:variable name="defaultMaxLength">-</xsl:variable>

	<!-- Libellé pour un format de type IdentifierType -->
    <xsl:variable name="identifierFormat">Identifiant</xsl:variable>
	<!-- Libellé pour un format de type CodeType -->
    <xsl:variable name="codeFormat">Code</xsl:variable>
	
	<!-- Nom du chapitre pour la balise racine -->
<!-- 	<xsl:variable name="rootElementChapterName">Structure de la balise racine</xsl:variable>
 -->
	<!-- Nom du chapitre pour les balises de déclaration du scénario d'échange -->
<!--  	<xsl:variable name="subRootElementChapterName">Balises de déclaration du scénario d'échange</xsl:variable>
 -->
 
	<!-- Nom du chapitre pour chacune des balises métier -->
    <xsl:variable name="childElementChapterName">Structure de l'élément</xsl:variable>
	<!-- Nom du chapitre pour les espaces de nommage -->	
<!-- 	<xsl:variable name="nsChapterName">Espaces de nommage</xsl:variable>
 -->
	<!-- Nom du chapitre pour les balises métier -->	
<!-- 	<xsl:variable name="childrenElementsChapterName">Description des balises de données métier</xsl:variable>
 -->
 
	<!-- Header du tableau des informations sur un élément -->
		<!-- Header général pour les caractéristiques des balises -->
    <xsl:variable name="headerValue1">CARACTERISTIQUES DES BALISES (ELEMENTS)</xsl:variable>
		<!-- Header général pour les caractéristiques des données -->
    <xsl:variable name="headerValue2">CARACTERISTIQUES DES DONNEES</xsl:variable>
		<!-- Header pour le nom d'un élément -->
    <xsl:variable name="headerValue3">Nom des éléments</xsl:variable>
		<!-- Header pour le type d'un élément -->
    <xsl:variable name="headerValue4">Type de l’élément</xsl:variable>
		<!-- Header pour le caractère obligatoire d'un élément -->
    <xsl:variable name="headerValue5">Caractère Obligatoire / Facultatif / Inutilisé de l’élément</xsl:variable>
		<!-- Header pour le nombre d'occurence d'un élément -->
    <xsl:variable name="headerValue6">Nombre (minimal, maximal) d’occurrence de l’élément</xsl:variable>
		<!-- Header pour le format d'un élément -->
    <xsl:variable name="headerValue7">Format</xsl:variable>
		<!-- Header pour la longueur maximum d'un élément -->
    <xsl:variable name="headerValue8">Longueur maximale (nombre de caractères)</xsl:variable>
		<!-- Header pour le commentaire d'un élément -->
    <xsl:variable name="headerValue9">Commentaires / Valeur(s)</xsl:variable>

	<!-- Header pour le tableau des espaces de nommage externe -->
		<!-- Header pour le préfixe d'un espace de nommage -->
    <xsl:variable name="nsHeaderValue1">Préfixe de l'espace de nommage externe</xsl:variable>
		<!-- Header pour l'URI d'un espace de nommage -->
    <xsl:variable name="nsHeaderValue2">Adresse URI de l'espace de nommage externe</xsl:variable>
		<!-- Header pour le nom d'un espace de nommage -->
    <xsl:variable name="nsHeaderValue3">Nom de l'espace de nommage</xsl:variable>

	<!-- Libellé d'une ligne indiquant le début d'une suite d'éléments dans un choice -->
    <xsl:variable name="startChoiceLineValue">début de choix</xsl:variable>
	<!-- Libellé d'une ligne indiquant la fin d'une suite d'éléments dans un choice -->
    <xsl:variable name="endChoiceLineValue">fin de choix</xsl:variable>


	<!-- 
		STYLES
	-->
	<!-- Style pour les chapitres -->
    <xsl:variable name="chapterStyleName">Heading_20_</xsl:variable>
	<!-- Style pour le tableau des informations d'un élément -->
    <xsl:variable name="elementTableStyleName">Standard</xsl:variable>
	<!-- Style pour les colonnes du tableau des informations d'un élément -->
    <xsl:variable name="elementTableColumnStyleNameA">Tableau5.A</xsl:variable>
    <xsl:variable name="elementTableColumnStyleNameG">Tableau5.G</xsl:variable>
    <xsl:variable name="elementTableColumnStyleName">Tableau5</xsl:variable>
	
	<!-- Style pour les contenus des header -->
    <xsl:variable name="headerValueStyleName">Table_20_Heading</xsl:variable>
	<!-- Style pour les header -->
    <xsl:variable name="elementTableHeaderRowStyleName">Tableau5.1</xsl:variable>
	<!-- Style de cellule pour les header de la première ligne -->
    <xsl:variable name="headerFirstLineStyleName">Tableau5.A1</xsl:variable>
	<!-- Style de cellule pour les header de la seconde ligne -->
    <xsl:variable name="headerScndLineStyleNameA">Tableau5.A2</xsl:variable>
    <xsl:variable name="headerScndLineStyleNameG">Tableau5.G2</xsl:variable>
	<!-- Style de ligne pour les informations d'un élément -->
    <xsl:variable name="elementTableRowStyleName">Standard</xsl:variable>
    <xsl:variable name="elementTableRowStyleName1">Standard</xsl:variable>
    <xsl:variable name="elementTableRowStyleName2">Standard</xsl:variable>	

	<!-- Style pour une valeur dans une cellule (premiere ligne hors header) -->
    <xsl:variable name="elementValueStyleNameA1">L1_20_Contenu_20_de_20_tableau_20_centré</xsl:variable>
    <xsl:variable name="elementValueStyleNameG1">L1_20_Table_20_Contents</xsl:variable>
	<!-- Style pour une valeur dans une cellule (hors header) -->
    <xsl:variable name="elementValueStyleNameA2">Contenu_20_de_20_tableau_20_centré</xsl:variable>
    <xsl:variable name="elementValueStyleNameG2">Table_20_Contents</xsl:variable>
	
	<!-- Style pour une valeur dans une cellule (premiere ligne hors header) -->
    <xsl:variable name="elementTextSpanStyleNameA1">T28</xsl:variable>
    <xsl:variable name="elementTextSpanStyleNameA2">P72</xsl:variable>
    <xsl:variable name="elementTextSpanStyleName1">T28</xsl:variable>
    <xsl:variable name="elementTextSpanStyleName2">Standard</xsl:variable>
	

	<!-- Style pour une cellule (premiere ligne hors header) -->
    <xsl:variable name="elementCellStyleNameA1">Tableau5.A3</xsl:variable>
    <xsl:variable name="elementCellStyleNameG1">Tableau5.G3</xsl:variable>	
	<!-- Style pour une cellule (hors header) -->
    <xsl:variable name="elementCellStyleNameA2">Tableau5.A2</xsl:variable>
    <xsl:variable name="elementCellStyleNameG2">Tableau5.G2</xsl:variable>	

<!-- INUTILE -->
	<!-- Style pour le tableau indiquant une séquence d'éléments dans un choice -->
    <xsl:variable name="choiceTableStyleName">Table4</xsl:variable>	
	<!-- Style pour les colonnes indiquant une séquence d'éléments dans un choice -->
    <xsl:variable name="choiceColumnStyleName">Table4.A</xsl:variable>
<!-- INUTILE -->
	
	<!-- Style pour les lignes indiquant une séquence d'éléments dans un choice -->
    <xsl:variable name="choiceRowStyleName">Table4.A</xsl:variable>
	<!-- Style pour la cellule dans une ligne  indiquant une séquence d'éléments dans un choice -->
    <xsl:variable name="choiceCellStyleName">Table4.A1</xsl:variable>
	<!-- Style pour le contenu d'une cellule dans une ligne  indiquant une séquence d'éléments dans un choice -->
    <xsl:variable name="choiceValueStyleName">P72</xsl:variable>
	
	<!-- Style pour la valeur des attributs obligatoires dans le nom d'un élément -->
    <xsl:variable name="mndAttInElementNameStyleName">T29</xsl:variable>
	<!-- Style pour la valeur du nom d'un élément simple -->
    <xsl:variable name="simpleElmntNameValueStyleName">Table_20_Contents</xsl:variable>
	<!-- Style pour la valeur du nom d'un élément ayant un seul sous-niveau -->
    <xsl:variable name="oneLevelElmntNameValueStyleName">Table_20_Contents</xsl:variable>
	<!-- Style pour la valeur du nom d'un élément ayant au moins deux sous-niveaux -->
    <xsl:variable name="twoLevelElmntNameValueStyleName">T28</xsl:variable>
	<!-- Style pour le tableau des espaces de nommage -->
    <xsl:variable name="nsTableStyleName">Standard</xsl:variable>
	<!-- Style pour les colonnes du tableau des espaces de nommage -->
    <xsl:variable name="nsTableColumnStyleName">Tableau1.A</xsl:variable>
	<!-- Style pour les lignes du header du tableau des espaces de nommage -->
    <xsl:variable name="nsTableHeaderRowStyleName">Standard</xsl:variable>
	<!-- Style pour les cellules du header du tableau des espaces de nommage -->
    <xsl:variable name="nsHeaderCellStyleName">Standard</xsl:variable>
	<!-- Style pour le contenu des cellules du header du tableau des espaces de nommage -->
    <xsl:variable name="nsHeaderValueStyleName">PremiereLigneTableau</xsl:variable>
	<!-- Style pour les lignes du tableau des espaces de nommage -->
    <xsl:variable name="nsTableRowStyleName">Standard</xsl:variable>
	<!-- Style pour les cellules du tableau des espaces de nommage -->
    <xsl:variable name="nsCellStyleName">Standard</xsl:variable>
	<!-- Style pour le contenu des cellules du tableau des espaces de nommage -->
    <xsl:variable name="nsValueStyleName">Standard</xsl:variable>
		<!-- Nom du style pour le paragraphe entourant une image du schéma conceptuel des données -->
    <xsl:variable name="imageParagraphStyleName">Standard</xsl:variable>
		<!-- Nom du style pour une image du schéma conceptuel des données -->
    <xsl:variable name="imageStyleName">Standard</xsl:variable>


	<!-- 
		AFFICHAGE DU TYPE DE L'ELEMENT
	-->
    <xsl:template name="displayElementType">
        <xsl:param name="type"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>						
		<!--type>
			<xsl:value-of select="$type"/>
		</type-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:value-of select="$type"/>
                </text:span>
            </text:p>
        </table:table-cell>
    </xsl:template>

	<!-- 
		AFFICHAGE DU CARACTERE OBLIGATOIRE DE L'ELEMENT
	-->
    <xsl:template name="displayElementMandatoryCaracteristic">
        <xsl:param name="mandatoryCaracteristic"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>						
		
		<!--mandatory>
			<xsl:value-of select="$mandatoryCaracteristic"/>		
		</mandatory-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:value-of select="$mandatoryCaracteristic"/>
                </text:span>
            </text:p>
        </table:table-cell>
    </xsl:template>

	<!-- 
		AFFICHAGE DES OCCURENCES MINIMUM & MAXIMUM  DE L'ELEMENT
	-->
    <xsl:template name="displayElementOccurences">
        <xsl:param name="minOccurences"/>
        <xsl:param name="maxOccurences"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>					
		
		<!--occurences>
			<xsl:value-of select="concat( '(', $minOccurences, ',' , $maxOccurences,  ')' )"/>		
		</occurences-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:value-of select="concat( '(', $minOccurences, ',' , $maxOccurences,  ')' )"/>
                </text:span>
            </text:p>
        </table:table-cell>
    </xsl:template>

	<!-- 
		AFFICHAGE DE LA LONGUEUR MAXIMUM  DE L'ELEMENT
	-->
    <xsl:template name="displayLengthMax">
        <xsl:param name="value"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>					
		
		<!--maxlength>
			<xsl:value-of select="$value"/>
		</maxlength-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:value-of select="$value"/>
                </text:span>
            </text:p>
        </table:table-cell>
    </xsl:template>

	<!-- 
		AFFICHAGE DU COMMENTAIRE DE L'ELEMENT
	-->
    <xsl:template name="displayComment">
        <xsl:param name="typeComment"/>
        <xsl:param name="elmntComment"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>
        <xsl:param name="code"/>
		<!--comment-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:if test="$typeComment">
                        <xsl:value-of select="$typeComment"/>
                    </xsl:if>
                    <xsl:if test="$elmntComment">
                        <xsl:if test="string($typeComment) != '' ">
                            <xsl:value-of select="' '"/>
                        </xsl:if>
                        <xsl:value-of select="$elmntComment"/>
                    </xsl:if>
                    <xsl:if test="string($code) != ''">
                        <xsl:if test="string($typeComment) != '' or string($elmntComment) != '' ">
                            <xsl:value-of select="' '"/>
                        </xsl:if>
<!-- 					<xsl:value-of select="concat($urlPrefixCodeType, $code, '.xml')"/>
 -->
                        <xsl:value-of select="concat($cfCodeList, $code)"/>
                    </xsl:if>
                </text:span>
            </text:p>
        </table:table-cell>
		<!--/comment-->
    </xsl:template>				

	<!-- 
		AFFICHAGE D'UN DEBUT DE CHOICE COMMENTAIRE DE L'ELEMENT
	-->
    <xsl:template name="displayStartChoice">
		<!--displayStartChoice/-->
        <table:table-row table:style-name="{$choiceRowStyleName}">
            <table:table-cell table:style-name="{$choiceCellStyleName}" table:number-columns-spanned="7" office:value-type="string">
                <text:p text:style-name="{$choiceValueStyleName}">
                    <xsl:value-of select="$startChoiceLineValue"/>
                </text:p>
            </table:table-cell>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
        </table:table-row>
    </xsl:template>

	<!-- 
		AFFICHAGE D'UNE FIN  DE CHOICE COMMENTAIRE DE L'ELEMENT
	-->
    <xsl:template name="displayEndChoice">
		<!--displayEndChoice/-->
        <table:table-row table:style-name="{$choiceRowStyleName}">
            <table:table-cell table:style-name="{$choiceCellStyleName}" table:number-columns-spanned="7" office:value-type="string">
                <text:p text:style-name="{$choiceValueStyleName}">
                    <xsl:value-of select="$endChoiceLineValue"/>
                </text:p>
            </table:table-cell>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
        </table:table-row>
    </xsl:template>

	<!-- 
		AFFICHAGE DU FORMAT DE L'ELEMENT
	-->
    <xsl:template name="displayFormat">
        <xsl:param name="format"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>		
				
		<!--format-->
        <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
            <text:p text:style-name="{$textStyleName}">
                <text:span text:style-name="{$textSpanStyleName}">
                    <xsl:value-of select="$format"/>
                </text:span>
            </text:p>
        </table:table-cell>
		<!--/format-->
    </xsl:template>

	<!-- 
		AFFICHAGE DES CHAPITRES DES ELEMENTS
	-->
<!-- 	<xsl:template name="displayChildrenElementsChapterName">
		<xsl:param name="level" select="3" />
		<text:p/>
		<text:h text:style-name="{$chapterStyleName}{$level}" text:outline-level="{$level}"><xsl:value-of select="$childrenElementsChapterName"/></text:h>
		<text:p/>
	</xsl:template>
 -->
 
	<!-- 
		AFFICHAGE DU CHAPITRE DE LA BALISE RACINE
	-->
<!--	<xsl:template name="displayRootElementChapter">
		<xsl:param name="level" select="4" />
		<text:p text:style-name="P68" />
		<text:h text:style-name="{$chapterStyleName}{$level}" text:outline-level="{$level}"><xsl:value-of select="$rootElementChapterName"/></text:h>
		<text:p/>
	</xsl:template>
	-->
	
	<!-- 
		AFFICHAGE DU CHAPITRE DES BALISES SCENARIO
	-->
<!--	<xsl:template name="displaySubRootElementChapter">
		<xsl:param name="level" select="4" />
		<text:p/>	
		<text:h text:style-name="{$chapterStyleName}{$level}" text:outline-level="{$level}"><xsl:value-of select="$subRootElementChapterName"/></text:h>
		<text:p/>		
	</xsl:template>
	-->
	
	<!-- 
		AFFICHAGE DU CHAPITRE D'UN ELEMENT XML DES BALISES DE DONNEES METIER
	-->
    <xsl:template name="displayChildElementChapter">
        <xsl:param name="elementName"/>
        <xsl:param name="level" select="3"/>
        <text:p text:style-name="P68"/>
        <text:h text:style-name="{$chapterStyleName}{$level}" text:outline-level="{$level}">
            <text:reference-mark-start text:name="{$elementName}"/>
            <xsl:value-of select="concat($childElementChapterName, ' &lt;', $elementName, '&gt;')"/>
            <text:reference-mark-end text:name="{$elementName}"/>
        </text:h>
    </xsl:template>

	<!-- 
		AFFICHAGE DU CHAPITRE DES NAMESPACE
	-->	
<!--	<xsl:template name="displayNsChapter">
		<xsl:param name="level" select="2" />
		<text:p/><text:p/>	
		<text:h text:style-name="{$chapterStyleName}{$level}" text:outline-level="{$level}"><xsl:value-of select="$nsChapterName"/></text:h>
		<text:p/>		
	</xsl:template>
	-->
	
	<!-- 
		AFFICHAGE D'UNE LIGNE VIDE
	-->
    <xsl:template name="displayEmptyLine">
        <text:p/>
    </xsl:template>

	<!-- 
		AFFICHAGE DES INFORMATIONS D'UN ELEMENT
	-->
    <xsl:template name="displayElementValues">
        <xsl:param name="name"/>
        <xsl:param name="mndAtt"/>
        <xsl:param name="othersAtt"/>
        <xsl:param name="type"/>
        <xsl:param name="mandatoryCaracteristic"/>
        <xsl:param name="minOccurences"/>
        <xsl:param name="maxOccurences"/>
        <xsl:param name="format"/>
        <xsl:param name="value"/>
        <xsl:param name="typeComment"/>
        <xsl:param name="elmntComment"/>
        <xsl:param name="code"/>
        <xsl:param name="maxLength"/>
        <xsl:param name="isSimple"/>
        <xsl:param name="isOneLevel"/>
        <xsl:param name="isTwoLevel"/>
        <xsl:param name="first"/>
        <xsl:choose>
            <xsl:when test="string($first)=string(true())">
                <table:table-row table:style-name="{$elementTableRowStyleName1}">
                    <xsl:call-template name="displayElementName">
                        <xsl:with-param name="name" select="$name"/>
                        <xsl:with-param name="mndAtt" select="$mndAtt"/>
                        <xsl:with-param name="othersAtt" select="$othersAtt"/>
                        <xsl:with-param name="isSimple" select="$isSimple"/>
                        <xsl:with-param name="isOneLevel" select="$isOneLevel"/>
                        <xsl:with-param name="isTwoLevel" select="$isTwoLevel"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleNameA1"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementType">
                        <xsl:with-param name="type" select="$type"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementMandatoryCaracteristic">
                        <xsl:with-param name="mandatoryCaracteristic" select="$mandatoryCaracteristic"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementOccurences">
                        <xsl:with-param name="minOccurences" select="$minOccurences"/>
                        <xsl:with-param name="maxOccurences" select="$maxOccurences"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                    <xsl:call-template name="computeElementFormat">
                        <xsl:with-param name="format" select="$format"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayLengthMax">
                        <xsl:with-param name="value" select="$maxLength"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayComment">
                        <xsl:with-param name="typeComment" select="$typeComment"/>
                        <xsl:with-param name="elmntComment" select="$elmntComment"/>
                        <xsl:with-param name="code" select="$code"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameG1"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameG1"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName1"/>
                    </xsl:call-template>
                </table:table-row>
            </xsl:when>
            <xsl:otherwise>
                <table:table-row table:style-name="{$elementTableRowStyleName2}">
                    <xsl:call-template name="displayElementName">
                        <xsl:with-param name="name" select="$name"/>
                        <xsl:with-param name="mndAtt" select="$mndAtt"/>
                        <xsl:with-param name="othersAtt" select="$othersAtt"/>
                        <xsl:with-param name="isSimple" select="$isSimple"/>
                        <xsl:with-param name="isOneLevel" select="$isOneLevel"/>
                        <xsl:with-param name="isTwoLevel" select="$isTwoLevel"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleNameA2"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementType">
                        <xsl:with-param name="type" select="$type"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementMandatoryCaracteristic">
                        <xsl:with-param name="mandatoryCaracteristic" select="$mandatoryCaracteristic"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayElementOccurences">
                        <xsl:with-param name="minOccurences" select="$minOccurences"/>
                        <xsl:with-param name="maxOccurences" select="$maxOccurences"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                    <xsl:call-template name="computeElementFormat">
                        <xsl:with-param name="format" select="$format"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayLengthMax">
                        <xsl:with-param name="value" select="$maxLength"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameA2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameA2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                    <xsl:call-template name="displayComment">
                        <xsl:with-param name="typeComment" select="$typeComment"/>
                        <xsl:with-param name="elmntComment" select="$elmntComment"/>
                        <xsl:with-param name="code" select="$code"/>
                        <xsl:with-param name="cellStyleName" select="$elementCellStyleNameG2"/>
                        <xsl:with-param name="textStyleName" select="$elementValueStyleNameG2"/>
                        <xsl:with-param name="textSpanStyleName" select="$elementTextSpanStyleName2"/>
                    </xsl:call-template>
                </table:table-row>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

	<!-- 
		TRAITEMENT DU FORMAT DE L'ELEMENT
	-->
    <xsl:template name="computeElementFormat">
        <xsl:param name="format"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>
        <xsl:variable name="formatElmt">
            <xsl:choose>
                <xsl:when test=" $format = 'TextType' ">
                    <xsl:value-of select="$texteFormat"/>
                </xsl:when>
                <xsl:when test="$format='NumericType'">
                    <xsl:value-of select="$numericFormat"/>
                </xsl:when>
                <xsl:when test="$format='DateType'">
                    <xsl:value-of select="$dateFormat"/>
                </xsl:when>
                <xsl:when test="$format='TimeType'">
                    <xsl:value-of select="$timeFormat"/>
                </xsl:when>
                <xsl:when test="$format='DateTimeType'">
                    <xsl:value-of select="$dateTimeFormat"/>
                </xsl:when>
                <xsl:when test="$format='IndicatorType'">
                    <xsl:value-of select="$indicatorFormat"/>
                </xsl:when>
                <xsl:when test="$format='BinaryObjectType'">
                    <xsl:value-of select="$binaryFormat"/>
                </xsl:when>
                <xsl:when test="$format='IdentifierType'">
                    <xsl:value-of select="$identifierFormat"/>
                </xsl:when>
                <xsl:when test="$format='CodeType'">
                    <xsl:value-of select="$codeFormat"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$format"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:call-template name="displayFormat">
            <xsl:with-param name="format" select="$formatElmt"/>
            <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
            <xsl:with-param name="textStyleName" select="$textStyleName"/>
            <xsl:with-param name="textSpanStyleName" select="$textStyleName"/>
        </xsl:call-template>
    </xsl:template>

	<!-- 
		AFFICHAGE DU NOM DE L'ELEMENT
	-->
    <xsl:template name="displayElementName">
        <xsl:param name="name"/>
        <xsl:param name="mndAtt"/>
        <xsl:param name="othersAtt"/>
        <xsl:param name="isSimple"/>
        <xsl:param name="isOneLevel"/>
        <xsl:param name="isTwoLevel"/>
        <xsl:param name="cellStyleName"/>
        <xsl:param name="textStyleName"/>
        <xsl:param name="textSpanStyleName"/>
        <xsl:variable name="styleName">
            <xsl:choose>
                <xsl:when test="string($isSimple)=string(true())">
                    <xsl:value-of select="$simpleElmntNameValueStyleName"/>
                </xsl:when>
                <xsl:when test="string($isOneLevel)=string(true())">
                    <xsl:value-of select="$oneLevelElmntNameValueStyleName"/>
                </xsl:when>
                <xsl:when test="string($isTwoLevel)=string(true())">
                    <xsl:value-of select="$twoLevelElmntNameValueStyleName"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$textStyleName"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

		<!--name-->
        <xsl:choose>
            <xsl:when test="string($isTwoLevel)=string(true())">
                <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
                    <text:p text:style-name="{$styleName}">
                        <text:reference-ref text:reference-format="text" text:ref-name="{$name}">
                            <xsl:value-of select="concat('&lt;', $name)"/>
                            <xsl:if test="string($mndAtt) != '' ">
                                <text:span text:style-name="{$mndAttInElementNameStyleName}">
                                    <xsl:value-of select="$mndAtt"/>
                                </text:span>
                            </xsl:if>
                            <xsl:if test="string($othersAtt) != '' ">
                                <xsl:value-of select="$othersAtt"/>
                            </xsl:if>
                            <xsl:value-of select="'&gt;'"/>
                        </text:reference-ref>
                    </text:p>
                </table:table-cell>
            </xsl:when>
            <xsl:otherwise>
                <table:table-cell table:style-name="{$cellStyleName}" office:value-type="string">
                    <text:p text:style-name="{$styleName}">
                        <xsl:value-of select="concat('&lt;', $name)"/>
                        <xsl:if test="string($mndAtt) != '' ">
                            <text:span text:style-name="{$mndAttInElementNameStyleName}">
                                <xsl:value-of select="$mndAtt"/>
                            </text:span>
                        </xsl:if>
                        <xsl:if test="string($othersAtt) != '' ">
                            <xsl:value-of select="$othersAtt"/>
                        </xsl:if>
                        <xsl:value-of select="'&gt;'"/>
                    </text:p>
                </table:table-cell>
            </xsl:otherwise>
        </xsl:choose>
		<!--/name-->
    </xsl:template>

	<!-- 
		AFFICHAGE D'UN NAMESPACE DANS LE TABLEAU
	-->
    <xsl:template name="displayOneNamespace">
        <xsl:param name="nsUrl"/>
        <xsl:param name="nsPrefix"/>
        <xsl:param name="nsTitle"/>
		<!--namespace>
			<xsl:value-of select="$nsUrl"/><xsl:value-of select="$nsPrefix"/><xsl:value-of select="$nsTitle"/>
		</namespace-->
        <table:table-row table:style-name="{$nsTableRowStyleName}">
            <table:table-cell table:style-name="{$nsCellStyleName}" office:value-type="string">
                <text:p text:style-name="Standard">
                    <text:span text:style-name="{$nsValueStyleName}">
                        <xsl:value-of select="$nsPrefix"/>
                    </text:span>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$nsCellStyleName}" office:value-type="string">
                <text:p text:style-name="Standard">
                    <text:span text:style-name="{$nsValueStyleName}">
                        <xsl:value-of select="$nsUrl"/>
                    </text:span>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$nsCellStyleName}" office:value-type="string">
                <text:p text:style-name="Standard">
                    <text:span text:style-name="{$nsValueStyleName}">
                        <xsl:value-of select="$nsTitle"/>
                    </text:span>
                </text:p>
            </table:table-cell>
        </table:table-row>
    </xsl:template>

	<!-- 
		AFFICHAGE DU HEADER DU TABLEAU DES NAMESPACE
	-->
    <xsl:template name="displayNsHeaders">
		<!-- <xsl:call-template name="displayNsChapter"/>  -->
        <table:table-column table:style-name="{$nsTableColumnStyleName}" table:number-columns-repeated="3"/>
        <table:table-row table:style-name="{$nsTableHeaderRowStyleName}">
            <table:table-cell table:style-name="{$nsHeaderCellStyleName}" office:value-type="string">
                <text:p text:style-name="{$nsHeaderValueStyleName}">
                    <xsl:value-of select="$nsHeaderValue1"/>
                </text:p>
                <text:p text:style-name="{$nsHeaderValueStyleName}"/>
            </table:table-cell>
            <table:table-cell table:style-name="{$nsHeaderCellStyleName}" office:value-type="string">
                <text:p text:style-name="{$nsHeaderValueStyleName}">
                    <xsl:value-of select="$nsHeaderValue2"/>
                </text:p>
                <text:p text:style-name="{$nsHeaderValueStyleName}"/>
            </table:table-cell>
            <table:table-cell table:style-name="{$nsHeaderCellStyleName}" office:value-type="string">
                <text:p text:style-name="{$nsHeaderValueStyleName}">
                    <xsl:value-of select="$nsHeaderValue3"/>
                </text:p>
                <text:p text:style-name="{$nsHeaderValueStyleName}"/>
            </table:table-cell>
        </table:table-row>
    </xsl:template>

	<!-- 
		AFFICHAGE DU HEADER DU TABLEAU D'UN ELEMENT
	-->
    <xsl:template name="displayElementTabHeader">
        <table:table-column table:style-name="{$elementTableColumnStyleName}.A"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.B"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.C"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.D"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.E"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.F"/>
        <table:table-column table:style-name="{$elementTableColumnStyleName}.G"/> 
<!-- 
		<table:table-column table:style-name="{$elementTableColumnStyleNameA}" table:number-columns-repeated="6" /> 
		<table:table-column table:style-name="{$elementTableColumnStyleNameG}" /> 
 -->
        <table:table-row table:style-name="{$elementTableHeaderRowStyleName}">
            <table:table-cell table:style-name="{$headerFirstLineStyleName}" table:number-columns-spanned="4" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue1"/>
                </text:p>
            </table:table-cell>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
            <table:table-cell table:style-name="{$headerFirstLineStyleName}" table:number-columns-spanned="3" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue2"/>
                </text:p>
            </table:table-cell>
            <table:covered-table-cell/>
            <table:covered-table-cell/>
        </table:table-row>
        <table:table-row table:style-name="{$elementTableHeaderRowStyleName}">
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue3"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue4"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue5"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue6"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue7"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameA}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue8"/>
                </text:p>
            </table:table-cell>
            <table:table-cell table:style-name="{$headerScndLineStyleNameG}" office:value-type="string">
                <text:p text:style-name="{$headerValueStyleName}">
                    <xsl:value-of select="$headerValue9"/>
                </text:p>
            </table:table-cell>
        </table:table-row>
    </xsl:template>
</xsl:stylesheet>