IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

[XPATH] Problème d'arborescence


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Membre habitué
    Inscrit en
    Mai 2007
    Messages
    262
    Détails du profil
    Informations personnelles :
    Âge : 37

    Informations forums :
    Inscription : Mai 2007
    Messages : 262
    Points : 172
    Points
    172
    Par défaut [XPATH] Problème d'arborescence
    Bonjour,

    J'ai un fichier XML comme ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    <Liste>
    	<IL type="E-FACPV">
    		<BILELT type="E-FACPV-LBPOP">
    			N° adhésion :  2.0115164.000
    		</BILELT>
    	</IL>
    	<IL type="E-FACLV">
    		<BILELT type="E-FACLV-AU">
    			31/03/2007
    		</BILELT>
    		<BILELT type="E-FACLV-DU">
    			01/01/2007
    		</BILELT>
    	</IL>
    	<Liste>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				CADRES : SALAIRE TRANCHE A
    			</BILELT>
    			<BILELT type="E-FACDV-TX">
    				7,8400
    			</BILELT>
    			<BILELT type="E-FACDV-TYPAS">
    				2
    			</BILELT>
    			<BILELT type="E-FACDV-MT">
    				630,81
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				8 804
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				AGFF CADRES : SALAIRE TA (HORS CP)
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				2,0000
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				3
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				156,00
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				7 800
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				ETAM : SALAIRE TRANCHE A
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				12,0100
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				0
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				5.239,59
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				43 627
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				ETAM : SALAIRE TRANCHE B
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				25,0700
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				0
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				0,00
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				0
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				AGFF ETAM : SALAIRE TA (HORS CP)
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				2,0000
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				3
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				770,80
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				38 540
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				AGFF ETAM : SALAIRE TB (HORS CP)
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				2,2000
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				0
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				0,00
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				0
    			</BILELT>
    		</IL>
    		<IL type="E-FACDV">
    			<BILELT type="E-FACDV-IDLIB">
    				ETAM FORFAIT FM - COTIS. JOURN.
    			</BILELT>
    			<BILELT type=">E-FACDV-TX">
    				2,7700
    			</BILELT>
    			<BILELT type=">E-FACDV-TYPAS">
    				0
    			</BILELT>
    			<BILELT type=">E-FACDV-MT">
    				1.495,80
    			</BILELT>
    			<BILELT type="E-FACDV-SAL">
    				540
    			</BILELT>
    		</IL>
    	</Liste>
    </Liste>
    Avec la première balise Liste, je crée un tableau et je veux insérer dans ce tableau la deuxième balise Liste...

    Voici un bout de XSL :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    <xsl:template match="Liste">
    <fo:block font-size="8pt" space-after="5mm" padding-top="0.5cm">
    		  <fo:table table-layout="automatic" inline-progression-dimension="100%"> 
    		    <fo:table-column  column-width="7cm"/>
    			<fo:table-column  column-width="4cm"/>
    			<fo:table-column  column-width="2cm"/>
    			<fo:table-column  column-width="0.5cm"/>
    			<fo:table-column  column-width="4.5cm"/>
     
    			<fo:table-header background-color="green" border="0.5pt">
    				<fo:table-row>
    				  <fo:table-cell>
    					<fo:block>
    					</fo:block>
    				  </fo:table-cell>
    				</fo:table-row>
    				<fo:table-row>
    				  <fo:table-cell number-columns-spanned="3">
    				    <fo:block color="white">
    					</fo:block>
    				  </fo:table-cell>
    				</fo:table-row>
    			</fo:table-header>
     
    			<fo:table-body>
    			  <fo:table-row>
    				<fo:table-cell>
    				  <fo:block text-align="left">
    				   <xsl:value-of select="IL[@type='E-FACPV']/BILELT[@type='E-FACPV-LBPOP']"/>
    				  </fo:block>
    				</fo:table-cell>
    				<fo:table-cell>
    				<fo:block color="blue">Période
    				</fo:block>
    				</fo:table-cell>
    				<fo:table-cell>
    				<fo:block>
    				<xsl:value-of select="IL[@type='E-FACLV']/BILELT[@type='E-FACLV-DU']"/>
    				</fo:block>
    				</fo:table-cell>
    				<fo:table-cell>
    				<fo:block color="blue">au
    				</fo:block>
    				</fo:table-cell>
    				<fo:table-cell>
    				<fo:block>
    				<xsl:value-of select="IL[@type='E-FACLV']/BILELT[@type='E-FACLV-AU']"/>
    				</fo:block>
    				</fo:table-cell>
    			  </fo:table-row>
     
    			  <xsl:apply-templates select="Document/Liste/Liste"/>
     
    			 </fo:table-body>
    		  </fo:table>
    		</fo:block>
    		</xsl:template>		
     
    <xsl:template match="Document/Liste/Liste">
    <fo:block font-size="8pt" space-after="5mm" padding-top="0.5cm">
    		  <fo:table table-layout="automatic" inline-progression-dimension="100%"> 
    		    <fo:table-column  column-width="7.5cm"/>
    			<fo:table-column  column-width="4.5cm"/>
    			<fo:table-column  column-width="3cm"/>
    			<fo:table-column  column-width="3cm"/>
    ...
    Etant donné que mes DEUX balises s'appellent Liste, j'ai un soucis au niveau des appels de fonction...

    Quelqu'un pourrait m'aider ??

    Merci d'avance !

  2. #2
    Expert éminent
    Avatar de GrandFather
    Inscrit en
    Mai 2004
    Messages
    4 587
    Détails du profil
    Informations personnelles :
    Âge : 54

    Informations forums :
    Inscription : Mai 2004
    Messages : 4 587
    Points : 7 103
    Points
    7 103
    Par défaut
    Bonjour,

    il faut que les "pattern matching" des deux templates s'excluent mutuellement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <xsl:template match="Document/Liste/Liste">
    ...
    </xsl:template>
    <xsl:template match="Document/Liste">
    ...
    </xsl:template>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 3
    Dernier message: 06/04/2007, 15h32
  2. [XPath] Problème de sélection de noeuds
    Par Heriquet dans le forum XSL/XSLT/XPATH
    Réponses: 5
    Dernier message: 18/02/2006, 10h22
  3. [Java][Xpath] Problème pour rédiger une expression
    Par althea_vestrit dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 23/01/2006, 20h53
  4. [XML-XPATH] Problème dans un for each
    Par stailer dans le forum XSL/XSLT/XPATH
    Réponses: 1
    Dernier message: 26/12/2005, 12h11
  5. recherche Xpath: problème de casse (majuscule/minuscule)
    Par alexandre54 dans le forum XSL/XSLT/XPATH
    Réponses: 9
    Dernier message: 29/07/2003, 10h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo