brothercake
02-06-2003, 11:37 AM
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="hello_world.xsl"?>
<!DOCTYPE kar_trends [
<!ELEMENT home_page (para*)>
<!ELEMENT para (#PCDATA)>
]>
<home_page>
<para>Hello world!</para>
</home_page>
viewed in any gecko browser, all I see is the node data - like a text file - instead of the result of the transformation. What am I doing wrong?
mpjbrennan
02-07-2003, 12:17 PM
Change the name of your xsl file to hello_world.xml - I had the same problem until Jason pointed out that text/xsl is not a recognised mime-type.
patrick
brothercake
02-07-2003, 01:23 PM
So - XSL stylesheets have to have the XML extension, because they're XML ... makes sense.
But I noticed that with
<?xml-stylesheet type="text/xml" href="hello_world.xsl.xml"?>
it doesn't work in IE6 anymore ... but with "text/xsl" as the mimetype and .xml as the extension, it works in both.
Is that one of those IE being stupid things ... that actually there is no such thing as "text/xsl" ?
mpjbrennan
02-07-2003, 02:14 PM
Yes, it's an IE workaround - refer to the stylesheet type as text/xsl in the declaration or IE won't parse it. Mozilla just ignores this part of the declaration.
patrick
liorean
03-12-2003, 10:01 PM
Mozilla doesn't really ignore it - this attribute is really just informative in a way that it tells the browser what to expect. Since the real file is sent with text/xml or application/xml, and mozilla has a parser for those, it gets parsed anyway.
IE on the other hand doesn't have a very compliant mime-type handling, and instead relies solely on the type attribute, and with an unregistred mime-type value at that.
As for the text/xsl mime-type, it's very unlikely it would get registred. As it is an xml language, it would more likely be text/xsl+xml or application/xsl+xml, if text/xml and a namespace declaration weren't good enough.