Navigation überspringen und mit dem Inhalt fortfahren
xml-stylesheet
9/8/2003
Letztlich war des öfteren die Rede von der XML
Stylesheet Processing Instruction (PI). Wie auch immer, noch benutze
ich diese Instruktion nicht, obwohl ich sollte, da ich meine Dateien als application/xhtml+xml
an den Browser schicke. Da die Auswahl von Alternativen Seitenstilen für
mich immer interessant ist, war ich neugierig inwiefern diese Unterstützung
von modernen Browsern erfährt, wenn man die XML PI benutzt.
Also habe ich folgenden Quelltext ausprobiert:
<?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"?>
Die Datei basic.css definiert die Stile für den Seitenhintergrund und
die Überschrift. Ich habe das Titel-Attribut weggelassen, um ein "beharrliches"
(eng.: persistent) Stylesheet
daraus zu machen (soll heissen, dieses Stylesheet wird immer mitgeladen und
angezeigt, auch wenn man einen der anderen drei Stile auswählt).
Die alternativen (eng.: alternate)
und bevorzugten (eng.: preferred)
Stylesheets definieren lediglich die Textfarbe und Schriftart.
Probiert einfach diese Testdatei
aus. Benutzt einen Browser, der mit application/xhtml+xml
(Gecko or Opera 6/7) umgehen kann. Klickt auf Anzeige --> Styles und wählt
das entsprechende Stylesheet aus (Red, Blue
oder Green).
Mehr Infos zu beharrlichen, bevorzugten und alternativen Styles gibt es bei
A List Apart:
Alternative
Styles
Das W3C hat eine Empfehlung
zu Stylesheets und XML-Dateien herausgegeben:
Associating
Style Sheets with XML documents Version 1.0
Kommentare
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').
Abgegeben am 9/8/2003 1 um 48:08 PM
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?
Abgegeben am 9/9/2003 5 um 52:55 PM
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?
Abgegeben am 9/9/2003 6 um 22:21 PM
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.
Abgegeben am 9/9/2003 7 um 40:52 PM
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. :)
Abgegeben am 9/9/2003 9 um 56:55 PM
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.
Abgegeben am 9/9/2003 1 um 41:08 PM
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.
Abgegeben am 9/13/2003 um 46:09 PM
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.
Abgegeben am 9/14/2003 um 25:23 PM