I have a few XML demo pages on my site. All of them have been checked out using both IE6 and Mozilla 1.0 and they perform as expected when accessed from the C: drive. When I upload them to my site however Mozilla does not want to play. I click on a link and get the status message "Document:done", but the display does not change. However if I then click on "View Source" I get the coding for the page I am trying to access. I just don't understand it. Can anyone shed any light on this?
OK - I wasn't sure what Jason was referring to. The line you quote is the format recommended in all the XSL references I have read. It's also the format used in the W3Schools web tutorials - for example check out the following link (which incidentally transforms nicely in Mozilla!)
Your comments led me to experiment however and what I discovered was that if I rename my xsl stylesheet and give it a .xml suffix then it works fine. It may be that my ISP server doesn't properly serve up the .xsl mime-type - though why that doesn't also affect Internet Explorer is a mystery to me.
update: I copied the w3schools xml and xsl files to my site and got exactly the same behaviour - transformation with IE but not Mozilla, even though Mozilla does successfully transform these same files when I access them directly from w3schools.com. The problem must therefore be due to the way my site server is dishing up the files.
patrick
Last edited by mpjbrennan; 01-18-2003 at 02:41 PM..
Personally, I've had very little succes in client-side transformation in mozilla; perhaps for the same reasons as you (whatever they are - sorry I don't know) ... I never really investigated because IMHO client-side transformation is a non-starter for practical applications; I'd do it server-side.
I got the text/xsl mime-type from trying to view your XSLT document on your server. It asks me to download it (claiming the mime-type is text/xsl.)
As unbelievable as this sounds, but w3schools is often trash when it comes to XML and such. There is no such mime-type as text/xsl. It is simply IE being stupid, once again. (Kind of like older versions of MSXML not supporting the correct XSLT namespace)
However, Mozilla does let you do type="text/xsl" in the processing instruction tag, because I believe IE requires it (it is so stupid!!).
However, the document MUST be served as text/xml, as per the XSLT 1.0 specification. Mozilla has strict enforcement of mime-types. Unlike IE, it doesn't do mime-type second-guessing or even overriding based on the extension, as file extensions are meaningless on the web.
I've never had any problems with client-side XSLT transformation in Mozilla when I'm doing everything correctly.
- Michael Kay also uses it in his book "XSLT" 2nd edition. Most people regard this as a fairly definitive work.
Older versions of IE supported the working draft namespace for xsl because there wasn't anything else at the time - I don't think that was being stupid, I think it was being helpful, giving users a tool to experiment with. Present versions of IE use the correct namespace.
I found your comments regarding mime-types very interesting and from a brief read of the subject at IANA I see that you are right that text/xsl is not a recognised type. I shall look into this further.
patrick
Last edited by mpjbrennan; 01-18-2003 at 07:55 PM..
- Michael Kay also uses it in his book "XSLT" 2nd edition. Most people regard this as a fairly definitive work.
Well it is technically incorrect. I think it is common practice because IE requires it (? I don't actually remember if it transform with type="text/xml" or not...), and Mozilla is smart enough to use the real mime-type of the file.
Originally posted by mpjbrennan Older versions of IE supported the working draft namespace for xsl because there wasn't anything else at the time - I don't think that was being stupid, I think it was being helpful, giving users a tool to experiment with. Present versions of IE use the correct namespace.
Yes, that was very nice. However after XSLT was standardized, it didn't support the correct namespace for some time. That was what bugged me.
Can you help me with one more aspect. I have changed all my xsl stylesheets to .xml and they now render satisfactorily in both IE and Mozilla. As I am in the process of migrating from Windows to Linux this is v. important for me. However, I find that in Mozilla all my pages are surrounded with a white margin. How can I get rid of this? I have looked through the CSS spec but cannot find any answer. The following page gives an example:
I don't wanna stray off topic too much ... or rant too much ... but doesn't all this cross-browser XML parsing idiosynchrasies stuff just turn you off completely? I don't dispute for a second that mozilla is correct over IE, but it's not that - it's that XML is supposed to free us from tedious environment specific logic. Why have any truck with anything that makes that harder?
Personally, I have no time for client-side transformation at all; or is there something amazingly useful which can't be done any other way but client-side, and I'm just failing to see it?
Originally posted by brothercake Why have any truck with anything that makes that harder?
You're not. This is why IE is continuing to stunt and retard the future of the web.
The only advantage I've come across with client-side transformations is that you don't need a server with sablotron or something equivalent installed, which is an issue for some people. It also takes some load off the server, especially if you're transforming relatively large documents.
Thanks Jason - I hadn't thought of assigning the background attribute to the html element but it did the trick.
I think it's a little extreme to say that IE is stunting and retarding the future of the web. Standards are important, but only if they are good standards. Personally I think the XSLT standard is flawed in one major aspect - it relies upon a processing instruction to be embedded in the XML document which is being transformed. This defeats the central objective of having pure data in an XML document. IMHO an XSL stylesheet should import the XML document it is to transform. The it would truly be possible for an XML document to be transformed by several different stylesheets.
End of rant - once again thanks for the assistance.