In HTML 4, style sheets are linked by <link> elements whose 'rel' attribute (which is case-insensitive) has a value that contains the keyword 'stylesheet'; the value of the 'rel' attribute may contain other keywords, too, in which case all keywords are separated by HTML space characters. The status of a style sheet in relation to an HTML 4 document relies both on the mentioned 'rel' attribute of and on the 'title' attribute of the <link> element which links the style sheet to the document. All further references to the 'rel' attribute and to the 'title' attribute refer to the attributes of such a <link> element.
HTML 4 also provides a <style> element and a 'style' attribute which allow authors to include style sheet information in their documents.
In HTML 4, style sheets are either regulated or unregulated. (This is my interpretation of the HTML 4 specification and is not in the HTML 4 specification; perhaps the specification authors did not realize that they had left certain cases unregulated.) If 'stylesheet' (or a case-insensitive variant) is the value of the 'rel' attribute, the style sheet is regulated. If 'alternate stylesheet' (or a case-insensitive variant) is the value of the 'rel' attribute, the status of the style sheet depends on the 'title' attribute (which is case-sensitive). A style sheet is unregulated if the value of the 'rel' attribute is not 'stylesheet' (or a case-insensitive variant) and is not 'alternate stylesheet' (or a case-insensitive variant). In the case that 'alternate stylesheet' (or a case-insensitive variant) is the value of the 'rel' attribute, the style sheet is regulated if the 'title' attribute is set to any value (including the null string, as in <title="">), and the style sheet is unregulated if the 'title' attribute is not set.
In HTML 4, regulated style sheets are either persistent or non-persistent. A regulated style sheet is persistent if there is no assignment to the 'title' attribute and the 'rel' attribute has the value 'stylesheet' (or a case-insensitive variant). If there is any assignment to the 'title' attribute, even if that assignment is the null string (as in <title="">), the style sheet is non-persistent. Each <style> element and 'style' attribute forms the equivalent of a persistent regulated style sheet.
HTML 4 requires user agents (including browsers) which handle style sheets to apply persistent style sheets as long as the user has not disabled all author style sheets. HTML 4 allows any number of persistent style sheets.
In HTML 4, non-persistent regulated style sheets are either preferred or non-preferred. A non-persistent regulated style sheet is preferred if 'stylesheet' is the value of the 'rel' attribute of the <link> element which links the style sheet.
In HTML 4, <style> elements and links to external style sheets may specify one or more target media with the 'media' attribute, indicating the types of situations in which the style sheet is appropriate. The value of the 'media' attribute is a comma-separated list of media types.
In HTML 4, non-persistent regulated style sheets form named styles. Each named style consists of one or more non-persistent regulated style sheets sharing the same value for the 'title' attribute (case-sensitive). (Note: does Unicode canonical equivalence matching apply? What about Unicode invisibles that Unicode specifies do not affect collation?) Since persistent regulated style sheets have no assignment to the 'title' attribute, persistent regulated style sheets can never participate in named styles. Although the specification does not mention that unregulated style sheets may participate in named styles, the specification specifies the following. "When a user selects a named style, the user agent must apply all style sheets with that name." Since unregulated style sheets may share a name with regulated style sheets, this seems to be a requirement to apply unregulated style sheets.
The specification later states that "User agents must respect media descriptors when applying any style sheet." This statement seemingly conflicts with the previous requirement to apply all style sheets in a selected named style and with the requirement that all persistent regulated style sheets must apply while author style sheets are enabled. Perhaps we should think of it in the following way, to reconcile these conflicts. The application of a style sheet begins by checking the target media types of the style sheet. If the current media type is not one of the target media types, the application of the style sheet is now complete, and the style sheet produces no effect on the rendering of the document.
"Authors may specify a number of mutually exclusive style sheets called alternate style sheets." conflicts with "Authors may group several alternate style sheets (including the author's preferred style sheets) under a single style name. When a user selects a named style, the user agent must apply all style sheets with that name." It seems clear that the second passage is operative while the first is in error. It is the named styles, not their member style sheets, which are mutually exclusive.
"The author may specify that one of the alternates is a preferred style sheet." Does this truly mean one style sheet, or does this mean one named style? In either case, specifying preferred style sheets in more than one named style is an error. Considering the HTML 4 specification's following statement, "User agents should apply the author's preferred style sheet unless the user has selected a different alternate.", it seems permissable that more than one style sheet in a single named style may be preferred and seems sensible that all style sheets in a single named style be preferred.
It is unwise to specify unregulated style sheets, since the treatment of unregulated style sheets may vary widely. It is hostile to users to specify persistent style sheets, which the user can disable only by disabling all author style sheets. Therefore keep to non-persistent regulated style sheets. That is, always set the 'title' attribute and make the value of the 'rel' attribute either 'stylesheet' (or a case-insensitive variant) or 'alternate stylesheet' (or a case-insensitive variant). If you specify more than one preferred style sheet, be sure that all preferred style sheets are in the same named style, that is, that all preferred style sheets have exactly the same value for their 'title' attribute. Within a named style, use a single style sheet language for all member style sheets, since the interaction between style sheet languages may be unpredictable. For each style sheet and <style> element, specify target media types so that user agents can avoid fruitless processing.
Make all style sheet controls easy. Do not automatically load style sheets advertised as for an irrelevant target medium or as of an unknown style sheet language. [more, especially handling of unregulated style sheets and of semantic error cases]