HTML <link rel="stylesheet"> underspecified with multiple languages

(Pardon the cross-posting, but this directly affects both HTML and the W3C
stylesheet languages as well as being an architectural issue. I strongly
suggest and request that discussion continue only in www-style@w3.org.)


HTML4's <link> element (when used to specify stylesheets), and thus the
<?xml-stylesheet> PI, is underspecified in two particular critical cases
and one useful case: first, multiple stylesheets when one is in a language
that does not cope with multiple stylesheets, second, multiple stylesheets
in different languages [1], and third, transforming stylesheets and
alternate stylesheets. In addition there are problems with the DOM.


Regarding the first point, the behaviour of UAs when hitting following
simple XML document is undefined:

   <?xml-stylesheet href="a" ?>
   <?xml-stylesheet href="b" ?>
   <foo/>

...if "a" is returned with the MIME type "text/xsl" (regardless of what
the MIME type of "b" is). Should the document be processed by stylesheet
"a"? Stylesheet "a" then stylesheet "b"? Should "b" be offered as an
alternative at any point? Should "b" be considered a second class citizen
and ignored? Consider the same questions but with "a" sent as "text/css"
and "b" sent as "text/xsl".


Regarding the second point, imagine if "a" is sent as "text/css" and "b"
is sent as "text/jsss" (a fictional MIME type for the JavaScript Style
Sheet nightmare that NS4 "supports"). Both of these support the concept of
a cascade, but their cascade mechanisms are incompatible. Which stylesheet
should be applied?


Third, consider the following:

   <?xml-stylesheet href="a" title="preferred" ?>
   <?xml-stylesheet href="b" title="alternate" ?>
   <bar/>

Imagine if "a" is sent as "text/css" and "b" is sent as "text/xsl". The
initial situation is well defined, the UA should provide a UI to the
alternate stylesheets (like Netscape 6.1 PR1 does [2]). However, if the
second stylesheet is selected, what should happen? Should the alternate
stylesheet UI disappear?


Finally, imagine that in the context of the following document:

   <baz/>

...the following script is executed:

   document.insertBefore(
      document.createProcessingInstruction('xml-stylesheet', 'href="a"'),
      document.documentElement);

...if "a" is sent back as "text/xsl". What happens to the DOM? What
happens to the document as far as the user is concerned?


These issues are all important architectural issues that should be
resolved as soon as possible, so that browser development continues in a
well defined manner and we don't end up in a situation where every browser
handles these examples differently.


-- Footnotes --
[1] http://www.w3.org/TR/html4/present/styles.html#h-14.4 says:
# Note. This specification does not specify how style sheets from
# different style languages cascade. Authors should avoid mixing style
# sheet languages.

[2] See, for example, the "View | Use Stylesheet" menu in that browser
while looking at http://damowmow.com/mozilla/demos/layout/ .

-- 
Ian Hickson                                            )\     _. - ._.)   fL
Invited Expert, CSS Working Group                     /. `- '  (  `--'
The views expressed in this message are strictly      `- , ) -  > ) \
personal and not those of Netscape or Mozilla. ________ (.' \) (.' -' ______

Received on Monday, 25 June 2001 13:28:25 UTC