http://qs321.pair.com?node_id=199967


in reply to Getting Netscape to use a linked XSL stylesheet

Hi,

I think ++BUU is right. When you load the file via HTTP, Netscape has to believe of whatever content type the server claims the file is. And I'd bet that it gets text/plain as the content type (maybe that's actually what you send it through CGI.pm), or no content type, where it'll probably assume text/plain. And in a plain text file, it does not expect and thus not obey any processing instructions (like your stylesheet link)

Now, if you save the file, and load it (as a file:// URI) in Netscape, it's on it own with determining the mime type. It sees the XML ending and assumes a text/xml content type. Being in XML context now, it sees, interprets and obeys the sylesheet PI.

I wonder what the HTTP specs say about what to assume if no content type is given. If it says text/plain is to be assumed, then actually IE6 misbehaves. But maybe it allows (or even encourages) browsers to apply their own type recognitions, when the server doesn't tell. When I got time I'll eventually read into it, and update this node.

Hope this lifts the fog,
so long,
Flexx

  • Comment on Re: Getting Netscape to use a linked XSL stylesheet

Replies are listed 'Best First'.
Re: Re: Getting Netscape to use a linked XSL stylesheet
by Fastolfe (Vicar) on Sep 23, 2002 at 00:09 UTC
    I don't believe it's legal to have an HTTP response without a valid Content-Type. A text/plain content-type, though, is fairly common as a "fall-back" for most web servers.

    The problem here is that IE never trusts the web server. When it receives what it considers a "possibly too generic" content type, it will second-guess the web server and try to figure out the content type on its own, so if it sees a text/plain content-type, but something that looks XML or HTML-ish, it will interpret it as XML or HTML.

    Most people view this as really evil/stupid behavior, since it encourages misconfigured web servers. Neither Mozilla nor Netscape have adopted this practice, to my knowledge.

      Yep. I didn't mean it's okay to send no content type header. And I also think that IE is an instrument of evil, but I feared to be voted down for being too honest about my opinion ;)

      And I'm sure the followers of the Gates Monastery ;) will argue how smart a "feature" it is to realize an XML document even if the server wants it to be viewed as plain text (for whatever reason -- none of the browsers business...) They're like their browsers: They think they know everything better... ;)

      Sorry, couldn't resist.. ;)

      Cheers, Flexx

      BTW, I wrote this on IE 6... >;|

Re: Re: Getting Netscape to use a linked XSL stylesheet
by AlistairFromScotland (Initiate) on Sep 23, 2002 at 19:38 UTC

    Unfortunately, specifying the content type as text/xml does not solve the problem. Netscape still displays the XML as XML without applying the XSL (i.e. without transforming it into XHTML.

    Alistair