Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2003, 09:30 PM   PM User | #1
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
Strange Mozilla behaviour?

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?

Here is a link to one of the pages:

http://www.patrick-brennan.com/xml/photo_album.xml

Patrick
mpjbrennan is offline   Reply With Quote
Old 01-17-2003, 10:34 PM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Shouldn't XSL be served as text/xml, not text/xsl (I don't believe that is a correct mime-type)?
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-18-2003, 08:02 AM   PM User | #3
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
Jason,

Where are you picking up the mime type text/xsl?

patrick
mpjbrennan is offline   Reply With Quote
Old 01-18-2003, 09:49 AM   PM User | #4
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
second line
<?xml-stylesheet type="text/xsl" href="photo_album.xsl"?>
__________________

Moderator: General web building

Get out from under them, resist and multiply.
Get out from under precipice and see the sky.
cg9com is offline   Reply With Quote
Old 01-18-2003, 01:05 PM   PM User | #5
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
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!)

http://www.w3schools.com/xsl/cdcatalog_with_xsl.xml

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..
mpjbrennan is offline   Reply With Quote
Old 01-18-2003, 02:51 PM   PM User | #6
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
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.
brothercake is offline   Reply With Quote
Old 01-18-2003, 03:57 PM   PM User | #7
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
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.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-18-2003, 07:49 PM   PM User | #8
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
Jason,

It isn't just w3schools that use the link

<?xml-stylesheet type="text/xsl" href=some_file.xsl"?>

- 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..
mpjbrennan is offline   Reply With Quote
Old 01-18-2003, 08:43 PM   PM User | #9
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Quote:
Originally posted by mpjbrennan
Jason,

It isn't just w3schools that use the link

<?xml-stylesheet type="text/xsl" href=some_file.xsl"?>

- 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.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-18-2003, 08:45 PM   PM User | #10
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Quote:
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.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-19-2003, 12:26 AM   PM User | #11
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
Jason,

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:

http://www.patrick-brennan.com/xml/photo_album.xml


thnx in anticipation

patrick
mpjbrennan is offline   Reply With Quote
Old 01-19-2003, 01:49 AM   PM User | #12
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Err, that's pretty odd. Perhaps:

*:root {
margin: 0;
}

Will fix it? I'm assuming the margin is being generated by the <html> element.... (you could use "html { }" as the selector in that case).
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-19-2003, 02:28 AM   PM User | #13
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
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?
brothercake is offline   Reply With Quote
Old 01-19-2003, 02:49 AM   PM User | #14
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Quote:
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.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 01-19-2003, 09:52 AM   PM User | #15
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
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.

patrick
mpjbrennan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:56 AM.


Advertisement
Log in to turn off these ads.