Bonjour à tous
Je requiert votre aide pour me sortir d'un soucis avec un fichier xml et xsl
Voilà mes compétences sont un peu limitées en la matière. Je voudrais mettre en forme le fichier xml avec le xsl (à moins qu'il y ait une autre solution).
J'ai suivi les tutos du site mais là je ne sais vraiment plus comment faire pour m'en sortir. Il faut que j'affiche un tableau recapitulatif des employés pour chaque statut dans chaque période. J'en profite pour vous demandez quel outil est le plus adapté pour çà. J'ai fouillé dans le sondage du forum et j'ai installé une démo de xmlspy mais çà m'a l'air compliqué pour une première approche xml/xsl. Qu'en pensez vous ?
le fichier xml
le fichier xsl que j'essaie de mettre au point.
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 <?xml version="1.0" standalone="yes" ?> <?xml-stylesheet type="text/xsl" href="./MesDonnees.xsl" ?> <Periodes> <Periode id="1"> <DateDeb>20/10/2005</DateDeb> <DateFin>20/10/2005</DateFin> <NumeroSem>42</NumeroSem> <Statuts> <Statut value="Maladie"> <Employes> <Employe> <nom>SALLE Marcel</nom> <nbPanier>0</nbPanier> <nbDeplacement>0</nbDeplacement> <nbHeures>8</nbHeures> </Employe> </Employes> </Statut> <Statut value="Présent"> <Employes> <Employe> <nom>AURIOUX Rémi</nom> <nbPanier>1</nbPanier> <nbDeplacement>1</nbDeplacement> <nbHeures>4</nbHeures> </Employe> <Employe> <nom>BERGE Jean-Jacques</nom> <nbPanier>1</nbPanier> <nbDeplacement>1</nbDeplacement> <nbHeures>8</nbHeures> </Employe> <Employe> <nom>THEBAULT Jean-Paul</nom> <nbPanier>1</nbPanier> <nbDeplacement>0</nbDeplacement> <nbHeures>8</nbHeures> </Employe> </Employes> </Statut> </Statuts> </Periode> <Periode id="2"> <DateDeb>30/10/2005</DateDeb> <DateFin>30/10/2005</DateFin> <NumeroSem>43</NumeroSem> <Statuts> <Statut value="Maladie"> <Employes> <Employe> <nom>toto</nom> <nbPanier>0</nbPanier> <nbDeplacement>0</nbDeplacement> <nbHeures>0</nbHeures> </Employe> </Employes> </Statut> </Statuts> </Periode> </Periodes>
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 <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:for-each select="Periodes/Periode"> <br> Du <xsl:value-of select="DateDeb"/> au <xsl:value-of select="DateFin"/> Semaine : <xsl:value-of select="NumeroSem"/> </br> <xsl:for-each select="Periodes/Periode/Statuts/Statut" > <br><xsl:value-of select="Statut"/></br> <table width="600" border="0" cellpadding="2"> <tr bgcolor="#ffcc66"> <td><div align="right">Employe</div></td> <td><div align="center">Nb. Panier</div></td> <td><div align="center">Nb. Deplacement</div></td> <td><div align="center">Nb. Heures</div></td> </tr> <xsl:for-each select="//Periode/Statuts/Statut[nom=current()]/Employes/Employe"> <tr bgcolor="#ffffcc"> <td><div align="right"><xsl:value-of select="nom"/></div></td> <td><div align="center"><xsl:value-of select="nbPanier"/></div></td> <td><div align="center"><xsl:value-of select="nbDeplacement"/></div></td> <td><div align="center"><xsl:value-of select="nbHeures"/></div></td> </tr> </xsl:for-each> </table> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
Merci d'avance
Partager