Re: Multiple Stylesheet Notations

On 25 Jul 95 at 15:58, Daniel Connolly wrote:

> In message <199507251510.JAA27319@white.nmt.edu>, Benjamin C. W. Sittler writes
> >How can a document author specify more than one format of stylesheet?

> In short: format negotiation.

[snip]

> I'll answer that question with a question:

I'll try some answers then, shall I? :-)

> 	For example, I have a graphic image in GIF, TIFF, and J-PEG
> 	that I would like sent to the browser depending on which
> 	format the browser can handle. How can I do this?

[1] Tells us about "Content Negotiation" in some detail, whilst [2] 
tells us about the "Accept header" in the Request message from the 
client to the server.

> 	I have HTML with tables, and another version without tables.
> 	How do I send the right data to the right clients?

Continuing the previous thread, using the references above, if we're 
using a file-based http server, then define files with the extension

HTML	as	text/html; version=2.0
HTML3	as	text/html; version=3.0

Then, your wonderful intelligent browser will, when it connects to 
the HTTP server, send a little HTTP header, 

Accept: text/html; version=2.0, image/gif

Which tells the server that it can only accept version 2.0 HTML, and 
GIF format images.

Likewise, an even more intelligent browser may do

Accept:	text/html; version=3.0; q=0.7,
		application/postscript; q=0.6; mxb=10000,
		text/html; version=2.0; q=0.5, 
		text/plain; q=0.4

Which means something like 

"I prefer you to send me version 3 HTML; if it's not available 
though, then I'll take postscript, please, as long as it's no bigger 
than 10000 bytes. If you've not even got that, or it's bigger than 
the 10000 bytes, then I suppose I'll have to just make do with plain 
old HTML version 2. If you've not got that, either, just send me 
plaintext".

> 	I have a bandwidth-intensive version of my data, and
> 	a low-bandwidth version of my data. How do I send the
> 	low-bandwidth version to the folks on slow links, and
> 	the rich version to the folks with high-speed connections?

Oops. Preempted myself there, didn't I. It's called[1]

mxb
     The maximum number of bytes in the Entity-Body accepted by the 
     client. The default value is mxb=undefined (i.e. infinity).

So, again, the intelligent client on a low bandwidth link can say

Accept:	text/html; version=3.0; mxb=5000; q=0.8
		text/html; version=3.0; q=0.6

telling the server that it would prefer the file to be sent which is 
less than 5000 bytes - however, if that's not available, then it'll 
take the larger one.

> 	I have a French, English, and German version of my documents.
> 	How can I send the right one depending on the language of
> 	the reader?

Back to [2], now, where we encounter

	5.4.4 Accept-Language

Which means that a browser can specify in the request header

Accept-Language: en-UK, en-US, dk

Meaning 

"I'd like english please first, and not just any english - I want the 
dialect spoken in the UK. Failing that, I'll accept American english. 
And, if you can't even manage that, then send danish"

If the server can't manage any of these, then it's quite entitled to 
send whatever else it wants or has available, working on the 
principle that un-intelligible information is better than no 
information at all, I suppose! :-)

The CERN server let's you indicate the language of a document by 
adding an extension to it, over and above the extension which 
indicate's it's content-type, I think.

> 10 points to the folks who can find the answer to these questions
> in the web at http://www.w3.org.

I claim my 10 points (assuming that I got these right; if not, I 
presume I go directly to Jail without collecting 200 pounds :-)

> And for anybody who tries to find the info and fails, would you
> send mail to me <connolly@w3.org> and to <webmaster@w3.org> describing
> your trials and tribulations? We'd like to get this fixed.

Personally, I don't think it's very broken. It's just a case of the 
fact that most of this lot's got more to do with HTTP than HTML, but 
most people seem to shy away from getting involved with what they 
(IMHO) incorrectly perceive as the "complicated" stuff.

It also doesn't help that, of course, much of /exactly/ how to 
achieve this in the real world this is dependent upon the server that 
you're using. I've no idea, to be frank, how /any/ server 
implementations actually handle in practice the business of 
identifying the specific "thing to send" when the partial URI is 
given - the request header[3] Request-URI is used to specify what we 
want;

Request-URI: /Some/Directory/Path/files.html

But this does tend to limit us to /only/ "files.html", regardless of 
whatever that may be. Presumably the server should be intelligent 
enough to take

Request-URI: /Some/Directory/Path/files

and then work out whether we want to receive files.html, files.html3, 
files.txt, or files.WhateverFormatThisIs from the 
/Some/Directory/Path/ location in the server?

References: 

[1]  <URL:http://www.w3.org/hypertext/WWW/Protocols/HTTP1.0/HTTP1.0-ID_38.html#HEADING112>
[2]  <URL:http://www.w3.org/hypertext/WWW/Protocols/HTTP1.0/HTTP1.0-ID_24.html#HEADING36>
[3]  <URL:http://www.w3.org/hypertext/WWW/Protocols/HTTP1.0/HTTP1.0-ID_23.html#HEADING35>

Regards,



Chris

--
Chris Tilbury, Estates Office, University of Warwick, UK, CV4 7AL
Tel: +44 1203 523523 x2665                   Fax: +44 1203 524444
MIME mail welcomed      mailto:Chris.Tilbury@estate.warwick.ac.uk

Received on Wednesday, 26 July 1995 05:08:18 UTC