freethinker
freethinker

Reputation: 1306

Why is that the xsl stylesheet is applied by the browser only when the extension is xml

For Eg.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>...</head>
  <body>
    <h1>Example</h1>
    ....
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mi>x</mi><mo>+</mo><mn>3</mn>
    </math>
  </body>
</html>

If the above file is named as mathml.xml, then firefox displays the mathml correctly, but not when its named as mathml.html.

Upvotes: 0

Views: 164

Answers (2)

codeplay
codeplay

Reputation: 610

you could use mathml.xhtml

Upvotes: 1

Nic Gibson
Nic Gibson

Reputation: 7143

Are you loading the file locally or over a network?

If it's over a network then your webserver is almost definitely setting the MIME type based on the file name suffix. You could check this by installing a Firefox extension such as Web Developer and checking the response headers.

If you are loading the file locally, your OS or your browser probably determine the MIME type from the file suffix.

Firefox is only going to process the xml-stylesheet PI when it identifies the file as XML.

Upvotes: 0

Related Questions