Bonsoir a tous
Le but est d'affiches les éléments déclarée dans mon fichier xml sous forme d"un beau tableau
le résultat dans le navigateur est : l'affichage des élémentssans le tableau
si quelqu’un peu m'aide merci d'avance
voici le code
fichier xml:
fichier 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 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="D:\simple2.xsl"?> <compilation> <mp3> <titre>Foule sentimentale</titre> <artiste>Alain Souchon</artiste> </mp3> <mp3> <titre>Solaar pleure</titre> <artiste>MC Solaar</artiste> </mp3> <mp3> <titre>Le baiser</titre> <artiste>Alain Souchon</artiste> </mp3> <mp3> <titre>Pourtant</titre> <artiste>Vanessa Paradis</artiste> </mp3> <mp3> <titre>Chambre avec vue</titre> <artiste>Henri Salvador</artiste> </mp3> </compilation>
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 <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <table border="1" cellspacing="0" cellpadding="3"> <tr bgcolor="#FFFF00"> <td>Titre</td> <td>Artiste</td> </tr> <xsl:for-each select="/compilation/mp3"> <tr> <td><xsl:value-of select="titre"/></td> <td><xsl:value-of select="artiste"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Partager