RE: CSS in XML format ?

> > the main syntax for CSS is impractical for a number of things. The
> > nice and compact syntax works well for humans and computers alike.
>
> I'm not aware than computers care much about compactness.

Not being sentient (just yet), I'm sure they don't actually care, but their
users will, as you're hopefully aware, string manipulation, particularly
with C style strings (and other kinds of byte streams, eg stuff coming over
a network) is hideously inefficient.

Currently, CSS is nice and simple to deal with as a stream -- you have a
property/value splitter and a value terminator. The counter argument to
this, is of course, to use the SAX APIs to interpret the stream, and not DOM
style ones (ever tried loading a medium sized XML doc as a DOM doc?)

As has been said many times already in this thread, is you want it, write
it. If it's useful in the general, then publish your DTD/Schema - at the
moment discussing an abstract idea that "could be useful" isn't going to
sell that idea to anyone.

I also happen to agree with Ian Hickson; XML is not really suited to CSS as
it is today, due to it's non treelike structure.

For the record, I'd refine his example to:
<rule>
 <selector> <!-- I guess there's nothing to stop you using Xpath queries
instead -->
  *:test &gt; test:*
 </selector>
 <declaration>
  <property>color</property>
  <value>
   <rgba red="25%" green="100%" blue="0%" alpha="0.5" />
  </value>
 </declaration>
</rule>
But I still prefer (if only for it's conciseness):
*|test > test|* { color: rgba( 25%, 100%, 0%, 0.5); }

Oh, for the record, I've written a simple CSS parser written in XSLT, but
it's not generalised enough for general use (it only handles in-line style,
(to convert some extensions into something User agents know about) and
modification of it).

Received on Thursday, 11 July 2002 08:06:10 UTC