The Artima Developer Community
Sponsored Link

Agile Buzz Forum
CSS as an XML format

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
CSS as an XML format Posted: Jan 29, 2004 5:46 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: CSS as an XML format
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

CSS is an excellent 'on the side' bonus to XML when it comes to presentation. So why isn't it an XML vocabulary in its own right?

Lets discuss possible reasons: It's easy to write than XML and when it was originally created it was made for HTML, not XML, thus, parsing CSS in its current syntax would have been easier back then than parsing XML.

Right, so now that we can parse XML very easily in just about every language under the sun, lets tackle that 'easy to write' nonsense. First off - there are no simple CSS editors out there because they have to deal with the syntax, not an XML DOM tree. Secondly, are they trying to out-do perl?: xhtml|h1.big[attribute='6'] > html|h2.small[attribute='5'] { color: red }

Lets talk practical reasons for having a CSS XML vocabulary. First a foremost, you could use CSS attributes 'class' and 'style' in -any- XML vocabulary by using a new namespace, eg:

<myTag css:class="myClass"/>

This breaks CSS away from its HTML heritage, just as W3 broke 'lang' away from its HTML heritage with the tag xml:lang.

Having it in another namespace would also help with XSLT, where you can now handle CSS easily as it is in its own namespace. You can also, as a developer, swap to your 'presentation logic' whenever you hit a CSS namespaced attribute or element.

What about definitions? There's no doubt at all that there would be more to type - if you didn't use an XML editor or a CSS XML editor. The CSS XML Editor would be much easier for vendors to create too.

Lets take an example:

h1 { color: red } would become:
<html:h1><color>red</color></html:h1>

That's not too much different. Also, we can now put that in to an XHTML document directly to apply styles where they are (much like style=, but using an actual XML element/attribute)

Another advantage: you can now change the CSS dynamically in its running environment using standard DOM methods!.

So I hope the W3 guys start catching wind of the many advantages to providing an XML vocabulary for CSS!

Read: CSS as an XML format

Topic: Bf now adapts to text changes Previous Topic   Next Topic Topic: How to interview

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use