Re: XML on Gecko

Subject: Re: XML on Gecko
From: Chris Lilley <chris@xxxxxx>
Date: Wed, 31 Mar 1999 19:52:23 +0200

Peter-Paul Koch wrote:
> (attribution lost wrote)
> >Gecko and other Mozilla clones support XML+CSS.
> 
> So I can use CSS to display XML? Wew, didn't know this. Thanks. 

Yes, also both IE5 and Gecko support it (using CSS on XML documents) so,
you can write one stylesheet and have it displayed, client-side, in both
of those browsers and any others that support CSS and XML.

You still might want to use XSL transformation, server side, do do XML
to XML transformations to generate a document which is suitable for
viewing. For example you might generate a navbar or table of contents
that way.

Actually, certainly until XSL FOs are better supported, using XSL to do
server-side transformation to XML and using CSS to do client-side
formatting and rendering is likely to be the best approach. Unlike the
situation when using CSS with HTML:

a) there are no hard-coded presentational bugs to work around
b) you know that each browser is working off the same parse tree

The latter point is important; I have only ever seen one browser handle
HTML 4.0 correctly as per the spec (as an SGML application), and there
is no spec for how to handle HTML with any extensions or any errors. Nor
can there be, given that HTML 4.0 uses SGML omissible start and end tags
and combining this with extensions (or errors) means that the parser
*cannot* infer the omitted tags correctly and thus, each browser ends up
with a different tree. So CSS selectors and 

> Do I have
> to do anything special,

No (well, remember that XML is case sensitive so CSS selectors for XML
are also case sensitive)

>  or just, say
> 
> name {font: 14px arial;}
> address {font-weight: 600;}

exactly.

And of course you can use contextual selectors and all that good stuff:

book title {display: block; text-align: center; 
            margin: 20pt;  font: 18pt/20pt Hattehschweiller, sans-serif}
chapter title {display: block; margin-left: -5%; 
              font: 14pt/16pt "Gill Sans", Helvetica, sans-serif}

which displays the title element differently for different uses.

You will also need to tell each element whether it is block, inline,
list, list-item, table-cell, etc because, unlike HTML

a) the browser doesn't know, so you have to tell it
b) the browser doesn't know, so when you do tell it, it obeys you ;-)

--
Chris


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread