Minz. Out of the box

xml-stylesheet

/2/9//03

There was some talk about the XML Stylesheet Processing Instruction (PI) lately. However, I am not yet serving my stylesheet using the PI, although I should when sending it as application/xhtml+xml to the User Agent. Since switching of styles is an issue for me, I was eager to know how the styles are treated if served via the XML PI.

So I tried the following markup:

<?xml-stylesheet href="basic.css" type="text/css" ?><!-- Persistent Styles -->
<?xml-stylesheet href="red.css" type="text/css" title="Red"?><!-- Preferred Styles -->
<?xml-stylesheet href="blue.css" type="text/css" title="Blue" alternate="yes"?>
<?xml-stylesheet href="green.css" type="text/css" title="Green" alternate="yes"?>

The basic.css styles the page's background as well as the h1. I left out the title to make it a persistent style (which means, this stylesheet is always turned "on").
Alternate and preferred stylesheet simply style the text color and the font face.

You can check this testcase out. Simply fire up a browser that is able to handle application/xhtml+xml (Gecko or Opera 6/7). Click on View --> Styles and select a style (Red, Blue or Green).

To learn more about persistent, preferred and alternate styles, I found this article very helpful:
Alternative Styles

The W3C has a recommendation out there:
Associating Style Sheets with XML documents Version 1.0

Comments

Thomas Scholz:

Works as expected in Opera 7.20 Beta 9 (Build 3106).
The bad thing is: I can not make PIs visible via user stylesheet (easy with 'link').

Posted: 09/08/2003

Minz Meyer:

[..] The bad thing is: I can not make PIs visible via user stylesheet (easy with 'link'). [..]

Sorry Thomas, I don't get that. Could you specify this a bit to a non-Opera user?

Posted: 09/09/2003

Thomas Scholz:

Follow my name. :)
You'll find a fragment of my 'diagnose.css' (I use a combination of three stylesheets, this is just one).

There is no possibility to address PIs with stylesheets. Maybe a bug in the CSS Specification?

Posted: 09/09/2003

Anne van Kesteren:

Thomas,
While other link elements _can_ have semantic value, the link element for style sheets is only there for including style sheets. _Not_ for adding semantic markup.
Though you have a point that it could benefit users. But then again, you can also check this with your browser.

Posted: 09/09/2003

Thomas Scholz:

To use or not to use 'link' isn't about semantic (although it may express a relationship, that <style>@import</style> or PIs never can express).
It's just not so geek friendly. :)

Posted: 09/09/2003

Minz Meyer:

Well, I really don't know if stylesheets are supposed to address something "outside" the document/root element.

Can't say if you can call this a bug. Maybe a proposal would be the right thing.

Posted: 09/09/2003

Michael:

Camino seems not to support stylesheets associated in this way as well as other Gecko-based browsers do. I 've seen empty spaces in pages using it where Firebird will display properly (e.g., at Dinodium: www.dionidium.com/ ).

On the pronunciation of XHTML: you've got the wrong fricative The "H" should be pronounced "aitch" not "age" in English - not that it matters much. I shan't describe in the IPA (international Phonetic Alphabet) as most people (including me) won't have the fonts:

http://www.sil.org/computing/catalog/show_software.asp?id=12

and see here:

http://www.phon.ucl.ac.uk/home/wells/ipa-unicode-test.htm

But perhaps in a shrinking world they may become useful. I am thinking of installing them.

"Rainer" the German voice at AT&T:

www.research.att.com/projects/tts/demo.html

pronounces just as you say. I think anything of this sort is a two-sided question, because the software that is reading out may not do as expected anyway.



Posted: 09/13/2003

Minz Meyer:

Michael,

thanks for the links. May become useful.
I didn't think much about the correct pronounciation when posting my entry, I just wanted to make clear the difference.

Thanks for clarifying it.

Posted: 09/14/2003