XML avec XSLT et CSS : la CSS n'est pas prise en compte -> ?
Bonjour,
Voilà, j'ai un petit programme qui fonctionne très bien (voir codes ci-dessous), sauf que le fichier CSS ne semble pas pris en compte par ma page XSLT (le texte aurait dû s'afficher en rouge !).
Y a t-il quelque chose que je n'aurais pas programmé correctement ?
Si vous avez quelque suggestion, par avance Merci !
Code XML:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="Audios/Audios.xsl"?>
<enregistrements>
<audios>
<enseignements>
<auteur nom="Gaston">
<album titre="Le Bonjour de Gaston">
</album>
</auteur>
</enseignements>
</audios>
</enregistrements> |
Code XSLT:
Code:
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
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Audio</title>
<link type="text/css" rel="stylesheet" href="Audios_css_Firefox.css" />
</head>
<body bgcolor="#FFFFFF">
<div id="Titre" style="position:absolute; width:700px; z-index:1; left: 100px; top:22px">
<xsl:value-of select="enregistrements/audios/enseignements/auteur/album/@titre"/>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |
Code CSS (Fichier "Audios_css_Firefox.css"):
Code:
1 2 3 4 5 6 7 8
|
#Titre
{
color: #9E352F; /* Texte en rouge */
font-weight: bold; /* Texte en gras */
font-size: 12 ;
font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
} |
PS : A noter que si j'intègre directement le contenu de la CSS dans la partie <head></head> du fichier XLST, comme ci-dessous, ça fonctionne, le texte apparait bien en rouge ! :? Quelqu'un saurait m'expliquer ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <head>
<title>Audio</title>
<style type="text/css">
#Titre
{
color: #9E352F; /* Texte en rouge */
font-weight: bold; /* Texte en gras */
font-size: 12 ;
font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
}
</style>
</head> |