Bonjour,
je tente de comprendre comment le xml et xsl peuvent fonctionner ensemble. Dans ce but, j'ai fait une petite galerie photos très simple avec:
- un fichier liste.xml décrivant les photos (nom du fichier)
- un fichier photo.xsl mettant en forme ce fichier
- un fichier styles.css pour définir la présentation
Ca ne fonctionne pas trop mal chez moi, mais:
- en local, le fichier xml et son xsl associé ne fonctionne que sous firefox et pas sous IE6.
- sur le serveur web, j'ai un message: Erreur lors du chargement de la feuille de style : Une feuille de style XSLT ne possède pas de type Mime XML sous firefox alors que ça fonctionne nickel sous IE...
J'ai fait une recherche sur le message d'erreur mais Google ne m'a pas aidé beaucoup sur ce coup là.
Pouvez vous me donner un début d'explication ?
Voici le lien vers ma galerie de test (ne fonctionnant donc que sous IE6)
(les liens sur cette pages renvoient sur la page, je ne suis pas allé plus loin, c'est juste une expériementation !)
le fichier liste.xml
le fichier photos.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 <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="photos.xsl"?> <galerie> <photos> <title>Ph'OtObOx</title> <logo>logotobox.jpg</logo> <repertoires> <repertoire> <titre>Accueil</titre> <lien>liste.xml</lien> </repertoire> <repertoire> <titre>Architecture</titre> <lien>liste.xml</lien> </repertoire> <repertoire> <titre>Marines</titre> <lien>liste.xml</lien> </repertoire> <repertoire> <titre>Contact</titre> <lien>mailto:jiem51@9online.fr</lien> </repertoire> </repertoires> <photo> <fichier>1.jpg</fichier> </photo> <photo> <fichier>2.jpg</fichier> </photo> <photo> <fichier>3.jpg</fichier> </photo> <photo> <fichier>4.jpg</fichier> </photo> <photo> <fichier>5.jpg</fichier> </photo> <photo> <fichier>6.jpg</fichier> </photo> <!-- donne le lien de la galerie suivante --> <fin> <lien>liste.xml</lien> </fin> </photos> </galerie>
Merci pour votre aide,
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 <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/galerie"> <!-- (c) OtObOx 2006 --> <html lang="fr" xml:lang="fr"> <head> <title><xsl:value-of select="photos/title" disable-output-escaping="yes"/></title> <link rel="stylesheet" type="text/css" href="styles.css" media="screen"/> </head> <body> <br></br><br></br><br></br> <a name="debut"></a> <table border="0" cellpadding="10" cellspacing="0"><tr><td> <table border="0" cellpadding="0" cellspacing="0"><tr> <td valign="TOP"> <table border="0" cellpadding="0" cellspacing="10"> <!-- INSERTION DU LOGO: --> <tr><td> <xsl:variable name="logo" select="photos/logo"/> <img src="{$logo}"></img> </td></tr> <!-- INSERTION DES RUBRIQUES: --> <xsl:for-each select="photos/repertoires/repertoire"> <xsl:variable name="nom_rep" select="titre"/> <xsl:variable name="lien" select="lien"/> <tr><td><a href="{$lien}"><xsl:value-of select="titre" disable-output-escaping="yes"/></a></td></tr> </xsl:for-each> </table> </td> <!-- INSERTION DES PHOTOS: --> <xsl:for-each select="photos/photo"> <td> <xsl:variable name="nom_fichier" select="fichier"/> <img src="{$nom_fichier}"></img> </td> </xsl:for-each> <!-- INSERTION DE LA FIN DE PAGE --> <td> <table border="0" cellpadding="10" cellspacing="10"> <tr><td><a href="#debut">Retour</a><br></br></td></tr> <xsl:for-each select="photos/fin"> <xsl:variable name="lien" select="lien"/> <tr><td><br></br><a href="{$lien}">Galerie suivante</a></td></tr> </xsl:for-each> </table> </td> </tr></table> </td></tr></table> <!-- INSERTION DU COPYRIGHT SOUS LE TABLEAU PRINCIPAL --> (c) jean-marc - 2006 </body> </html> </xsl:template> </xsl:stylesheet>
kenavo,
Jean-Marc
Partager