views:

39

answers:

2

For Eg.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
  <head>...</head>
  <body>
    <h1>Example</h1>
    ....
    <math xmlns="http://www.w3.org/1998/Math/MathML"&gt;
      <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.

A: 

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.

Nic Gibson
I tried both, locally as in giving the path to the file and using apache, in both cases I get the same result.
freethinker
That makes sense - locally, the browser is deciding that your file is XML by looking at the suffix. Over the network, apache is doing the same thing. You *could* (I wouldn't consider it good idea), force Apache to return an XML MIME type for .html files. I suppose the more important question would be - what were you trying to do?
Nic Gibson
Primary purpose is to use xsl inside html files, and then open an xml document on the server using the xsl document function and then transform it into a html nav menu. Basically using xsl document function as a replacement of SSI.
freethinker
OK, that sounds like you need to change the MIME type returned by the server. However, you need to be very careful about that because MSIE ignores the MIME type under many circumstances and other browsers will handle it well which means XML error behavior - make sure that your HTML is well-formed XML. You can change the MIME type using the AddType directive in Apache's config.
Nic Gibson
A: 

you could use mathml.xhtml

codeplay
Pretty cool, it does work with the xhtml extension, so now if i want to stick to the html extension, all I have to do is force apache to return the mime type as xhtml for files with html extension? how does one do that?
freethinker