I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?)
A concrete example: given the following XML
<log> <entry revision='1'> <author>J Random Hacker</author> <message>Some pithy explanation</message> </entry> </log>
I’d like to associate a CSS with this XML such that when viewed in a modern (WebKit, FireFox) browser, I see something like:
+----------------------------------+ | revision | 1 | +----------------------------------+ | author | J Random Hacker | +----------------------------------+ | message | Some pithy explanation| +----------------------------------+
Where my oh-so-beautiful ascii-art is meant to indicate some table-like layout.
That is: XML+CSS –> ‘pixels for user’ instead of XML+XSLT –> XHTML+CSS –> ‘pixels for user’.
My hope is that this approach could be simpler way (for me) to present XML documents that are already document-like in their structure. I’m also just plain curious.
It is indeed possible to use CSS to format an XML document.
W3 schools example
(The W3C do recommend using xslt to do this sort of thing instead CSS though)