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 xm开发者_Go百科lns="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.
you could use mathml.xhtml
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.
精彩评论