This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > December 2003 > XML and CSS
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Neil Zanella 2003-12-27, 12:28 am |
| Hello,
Could someone please give me an example of how to use CSS to define
the rendering of an XML document (as opposed to an ordinary XHTML
document). That is, the document must contain some custom tags.
Do any web browsers currently support the rendering of arbitrary
XML documents using CSS?
Thanks,
Neil
| |
| Jukka K. Korpela 2003-12-27, 5:28 am |
| nzanella@cs.mun.ca (Neil Zanella) wrote:
quote:
> Could someone please give me an example of how to use CSS to define
> the rendering of an XML document (as opposed to an ordinary XHTML
> document).
an .xml document, to be served as text/xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="cool.css"?>
<document>
<heading>XML+CSS demo</heading>
<paragraph>This is a <cool>simple</cool> test.</paragraph>
</document>
a .css document, to be served as text/css:
heading, paragraph { display: block; }
heading { font-size: 130%; margin-bottom: 1em; }
cool { font-style: italic; }
quote:
> That is, the document must contain some custom tags.
Oh. Between the lines, I read that you would like to scatter around a
few homebrew tags into an HTML document and "define" their rendering in
CSS, presumably not considering what happens in non-CSS rendering.
In theory, advertizing the document as aprilcation... sorry
application/xhtml+xml would ask the browser do that, i.e. render the
document's HTML constructs as usual and accept some extra tags and play
with them by your CSS rules. This won't work well on the WWW since
IE completely fails to make any sense of that media type.
quote:
> Do any web browsers currently support the rendering of arbitrary
> XML documents using CSS?
Most modern graphic browsers do. What you lose is the universality of
HTML. For example, even if you wrote an aural style sheet (did you even
think of that?), there's probably not a single speech browser that
would render the document according to it - instead, they would not
render the XML document at all, or would render it by reading the
markup.
And users will not be able to switch off CSS (without a style sheet, an
XML document cannot really be rendered at all), or to have their user
style sheet participate in the cascade. In a word, from the user's
point of view, you would be decades back, in the bad old days when
documents were formatted for a single rendering situation.
So it's a much better approach (at present at least) to use good old
HTML, or XHTML if you wish to be illusioned into thinking it's better
because it's newer and the Latest Recommendation, and express the extra
markup using classes rather than tags. That is, instead of
<cool>...</cool> you would write <span class="cool">...</span>.
You will have the same problem with non-CSS rendering, but at least the
Market Leader will do something meaningful with your soup. Besides, if
you take some care and pay attention to what happens when CSS is not in
use, it might work just fine.
(You would naturally use <div class="...">...</div> for constructs that
should be rendered as blocks and not inline.)
--
Yucca, http://www.cs.tut.fi/~jkorpela/
| |
| JustAnotherGuy 2003-12-27, 6:28 pm |
| Jukka K. Korpela wrote:
quote:
> So it's a much better approach (at present at least) to use good old
> HTML, or XHTML if you wish to be illusioned into thinking it's better
> because it's newer and the Latest Recommendation
Sounds like an argument bandied about by the "why css" crowd as well...?
I mean, you might as well close some tags if it's going to future-proof
your work.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|