Ideas for ways of linking style sheets to documents

Style sheets, in CSS or XSL, can be linked to HTML files by means of a LINK element in the document. Several XML-based formats allow a "processing instruction" (PI) for the same purpose. But what if the document format has neither a LINK element nor a PI (SOAP is such a format) or if you don't want modify the document? There is currently no solution, but here are some ideas for new technology.

HTTP "Link" header

HTTP at one time had a header called "Link," that could be sent by a Web server along with the document that a client (usually a browser) requested. Such a header had the same function as the LINK element in HTML, except that it could be added by the server to any document, not just HTML. In the latest revision of HTTP, the Link header has been removed, since there were not enough correct implementations.

New HTTP header

Instead of resurrecting the "Link" header, one could also introduce a new HTTP header, specific to style sheets. It might be called "Stylesheet." A precedent for this is the "P3P" header, that was introduced by the P3P (Platform for Privacy Preferences) format to associate machine-readable privacy policies with documents.

Package format

A document could be combined with its style sheet in some form of archive file, such as tar, zip, or MIME-multipart, or some format derived from those. For extra flexibility, such a format could include something like a "manifest" file (like in Java Archives, or "jar" files), with instructions for the browser.

Well-known location

It is also possible to define a fixed URL on every server, where a browser can go and look for a default, site-wide style sheet. The precedent for this is the "robots.txt" file, that "spiders" (programs that automatically download a whole site) look for on each site to determine which parts of the site not to download. P3P also uses this mechanism. A P3P-aware browser will look for a file at the (relative) URL "/W3C/p3p.xml" to find the privacy policy for that site. For example, we could define that "/W3C/rdf.css" is the default CSS style sheet for generic RDF files and "/W3C/html.css" for HTML files (or, which means something subtly different, for all files that end in ".html").

Bert Bos
Created 27 November 2002