How can I style XML with CSS for viewing in a browser without first converting to (X) HTML?

I know that CSS can be used to control the presentation of (X) HTML in modern browsers. I got the impression that this is possible for arbitrary XML. (Am I mistaken?)

Case Study : Given XML

<log>
  <entry revision="1">
    <author>J Random Hacker</author>
    <message>Some pithy explanation</message>
  </entry>
</log>

I would like to associate CSS with this XML in such a way that when viewing in a modern browser (WebKit, FireFox) I see something like:

+----------------------------------+
| revision | 1                     |
+----------------------------------+
| author   | J Random Hacker       |
+----------------------------------+
| message  | Some pithy explanation|
+----------------------------------+

Where is my oh-oh-awesome ascii-art is for pointing out some kind of tabular layout.

That is: XML + CSS → “pixels for the user” instead of XML + XSLT → XHTML + CSS → “pixels for the user”.

, ( ) XML-, . .

+3
3

, CSS XML-.

W3

(W3C xslt, CSS)

+6

, CSS XML, HTML. , HTML- CSS, CSS, :

entry {
    display: block;
}
author {
    display: inline;
    font-weight: bold;
}
...

CSS XML , XML :

<?xml-stylesheet href="common.css" type="text/css"?>
+2

, . :

author{
   display:block;
   color:#888888;
}

.

+1

Source: https://habr.com/ru/post/1699378/


All Articles