W3C home > Mailing lists > Public > www-style@w3.org > July 2002

Re: CSS in XML format ?

From: Stuart Ballard <sballard@netreach.com>
Date: Wed, 10 Jul 2002 11:35:10 -0400
Message-ID: <3D2C542E.9050400@netreach.com>
To: Patrick Andries <pandries@iti.qc.ca>
CC: Lachlan Cannon <luminosity@members.evolt.org>, www-style@w3.org

Patrick Andries wrote:
> 
> Yes, I have heard this argument. Right now, having to convert it, I'm not at
> all convinced of its strength...

Compare the number of people in your position (having to convert it) to 
the number of people in the position of having to write it. Whose 
concerns should be given more weight, honestly?

> I see two schools of thought : the style sheet syntax must be terse and
> intuitive for human conception or the style sheet syntax should be in XML to
> be easily processable, verbosity is of no consequence since style sheets are
> more and more produced automatically or through an GUI interface (my case at
> least).

How about "both intuitive syntax *and* straightforward processability 
are important"? It's not like it's terribly hard to write code to parse 
and process CSS syntax, it's just that XSLT by itself isn't the right 
tool for the job.

I don't ever see a time when writing CSS by hand isn't important. GUI 
HTML editors have been around for years, and yet an awful lot of it is 
still written by hand. I don't see why CSS would be any different.

> You mean FO ? Unfortunately, I do not control the XHTML that I need to
> convert automatically. And these many files (constantly new ones are being
> created by the customer) use CSS !

It seems to me that the only time that an XML syntax for CSS is useful 
is for things that are internal to a particular project, and therefore 
not a useful thing for the W3C to standardize.

That's not to suggest that it's not a good thing to *do* for your 
particular problem domain. There's plenty of open-source code out there 
that can parse CSS's grammar (and even if you can't find code that meets 
your needs, the grammar is simple enough to write your own parser) - 
once you can do that, you can spit out XML in whatever form you like.

All you have to do is run your pages through a preprocessor that 
identifies <style></style> and <xxx style="..."> and converts the 
contents to your own XML representation. Then use XSLT to make whatever 
changes you want to make, then do the reverse transformation from XML to 
CSS in a "postprocessing" stage. You could even do *this* part in XSLT, 
also, because going from XML *to* text is something XSLT can do.

AIUI, some XSLT processors allow some kind of plugin functions that can 
be implemented in a language other than XSLT. So you could put your 
CSS-to-XML converter in that form and call it from your XSLT stylesheet.

Stuart.


-- 
Stuart Ballard, Programmer
NetReach - Internet Solutions
(215) 283-2300, ext. 126
http://www.netreach.com/
Received on Wednesday, 10 July 2002 11:35:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:15 GMT