Bonjour,
J'essaie, non sans mal, de m'initier à Mathml, XML, XSL, etc...
Je souhaite mettre en forme le fichier XML suivant grâce à une feuille de style XSLT :
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
 
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
 
<?xml-stylesheet type="text/xsl" href="fichier.xsl"?>
 
<exercice>
  <question libelle="a">
    <formule>
      <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mrow>
          <mrow>
            <mi>x</mi>
            <mo>=</mo>
            <mfrac>
              <mrow>
                <mo>-</mo>
                <mi>b</mi>
                <mo>&#x00b1;</mo>
                <msqrt>
                  <mrow>
                    <msup>
                      <mrow><mi>b</mi></mrow>
                      <mrow><mn>2</mn></mrow>
                    </msup>
                    <mo>-</mo>
                    <mn>4</mn>
                    <mi>a</mi>
                    <mi>c</mi>
                  </mrow>
                </msqrt>
              </mrow>
              <mrow><mn>2</mn><mi>a</mi></mrow>
            </mfrac>
          </mrow>
        </mrow>
      </math>
    </formule>
  </question>
  <question libelle="b">
    <formule> (7 x 100) + (4 x 10) + 5 +
      <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mrow>
          <mfrac>
            <mrow><mn>32</mn></mrow><mrow><mn>100</mn></mrow>
          </mfrac>
        </mrow>
      </math>= 745,32
    </formule>
  </question>
  <question libelle="c">
    <formule> (5 x 100) + (3 x 10) + 2 +
      <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mrow>
          <mfrac>
            <mrow><mn>4</mn></mrow>
            <mrow><mn>10</mn></mrow>
          </mfrac>
        </mrow>
        <mo>+</mo>
        <mrow>
          <mfrac>
            <mrow><mn>7</mn></mrow>
            <mrow><mn>100</mn></mrow>
          </mfrac>
        </mrow>
        <mo>+</mo>
        <mrow>
          <mfrac>
            <mrow><mn>6</mn></mrow>
            <mrow><mn>1000</mn></mrow>
          </mfrac>
        </mrow>
      </math>= 532,476
    </formule>
  </question>
</exercice>
Et le fichier XSL est le suivant :

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
 
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml" version="1.0" encoding="iso-8859-1"/> 
 
<!-- ============================================ -->
<!-- Traitement à effectuer pour l'élément racine -->
<!-- ============================================ -->
<xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="fr"
      xmlns:pref="http://www.w3.org/2002/Math/preference"
      pref:renderer="css">
    <head>
    </head>
    <body>
     	  <xsl:apply-templates />
    </body>
    </html>
</xsl:template>
 
<!-- ============================================== -->
<!-- Traitement à effectuer pour l'élément EXERCICE -->
<!-- ============================================== -->
<xsl:template match="exercice">
     <div id="corrige">
     	  <xsl:apply-templates />
     </div>
</xsl:template>
 
<!-- ============================================== -->
<!-- Traitement à effectuer pour l'élément QUESTION -->
<!-- ============================================== -->
<xsl:template match="question">
     <xsl:text>&#xA;</xsl:text>
     <b>
     <xsl:value-of select="@libelle"/>)
     </b>
     	  <xsl:apply-templates />
</xsl:template>
 
<xsl:include href="pmathml.xsl" />
 
</xsl:stylesheet>
A l'ouverture avec Firefox, les formules mathématiques s'affichent correctement mais pas la mise en forme (Retour à la ligne à chaque question, mise en gras...)
Et, beaucoup plus grave, bien qu'ayant installé MATHPLAYER, Internet Explorer, quant à lui, n'interprète pas le code Mathml.
Comment puis-je faire cohabiter tous ses formats et que ça fonctionne dans ces deux principaux navigateurs ?
Merci de votre aide