[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: CSS as XML

  • From: "Fraser Hore" <fraserhore@h...>
  • To: "'Henry S. Thompson'" <ht@i...>,"'bryan rasmussen'" <rasmussen.bryan@g...>
  • Date: Thu, 6 Sep 2007 15:19:03 -0400

RE:  CSS as XML
Thanks very much for the links to similar initiatives.  I have some
questions about the other approaches that I'm interested in perspectives on.
Please take my comments as a line of inquiry as they are not intended to be
critical in any way of other approaches.  

One thing I don't understand is why these approaches emulate so closely the
original CSS language and syntax.  It seems to me that CSS is a bit outdated
and not that logically clean.  If we're going to go to XML it might make
more sense to restructure things a bit to take advantage of XML's strengths.


For example, styling can be nicely organized by the elements being styled,
such as background, text, borders, etc.  This makes a really clear, simple
and logical structure:

<text>
	<color unit="rgb"/>
	<direction/>
	<line-height/>
	...
</text>

CSS on the other hand seems to have a not entirely consistent naming
convention.  For example, color defines text color, but you have to know
that.  Border-color, border-left-color, background-color, etc. make it more
clear what we're defining the color for, but why do we need define a schema
for all of those different elements.  Why not just define what color is, and
then use it in each of the contexts, such as:

<style nodeset="//div[id='@bodyText']">
	<text>
		<color unit="hex">000000</color>
	</text>
	<border>
		<top>
			<color unit="hex">111111</color>
		</top>
		<bottom>
			<color unit="hex">222222</color>
		</bottom>
	</border>
</style>

Admittedly, if you're coding CSS by hand it takes longer to write but use a
simple xform and it's way faster to code than CSS by hand!  

Other advantages to this structure are that it's super simple to learn and
extend, you can make a really clean schema, it's machine readable and
manipulable, and it's more aligned with standard xml practice.

Bryan, I can see the advantages in your approach of being able to quickly
define styles in only a few lines of code, such as:

Your approach:

<selector  id="p1">
<s name="color">#ff0000</s>
<s name="font">11pt Times</s>
</selector> 

My approach:

<style nodeset="*[id='p1']">
	<text>
		<color unit="hex">ff0000</color>
	</text>
	<font>
		<size unit="pt">11</size>
		<family>times</family>
	</font>
</style>

A drawback I see is that you would have to extend by adding compound
attribute values, such as background-color, border-left-color, etc.  So
basically all attributes are at the same level and you can't take advantage
of xml's hierarchical structure to give meaning.

Another issue is having multiple values defined in a single element.  For
instance: "11" "pt" "times".  This could make it harder to parse the values
automatically, it's harder to define the enumeration for allowable values
and the user has to know what values can be defined in the element because
it's not made explicit.  

A final comment is on the selector approach.  It's definitely easier to
borrow the current CSS selector syntax since you'll have to convert it to
CSS anyway, but it misses the opportunity to progress toward the use of
xpath, which is a powerful and widely used standard for everything else in
xml.  Xpath is also probably already more powerful than CSS selectors and
definitely seems to be maturing as a language much faster than CSS.  From a
user point of view, if I'm using xpath for xslt, xforms, etc. I'd like to
use it for CSS too. Why learn another language that does essentially the
same thing?

Thanks for the comments!?

Fraser  

-----Original Message-----
From: Henry S. Thompson [mailto:ht@i...] 
Sent: September 6, 2007 5:39 AM
To: bryan rasmussen
Cc: Fraser Hore; xml-dev@l...
Subject: Re:  CSS as XML

You both might be interested in some exploratory work [1] in this
space by the W3C mobileOK checker task force [2].

ht

[1] http://dev.w3.org/cvsweb/2007/cssxml/
[2] http://www.w3.org/2005/MWI/BPWG/Group/TaskForces/Checker/
-- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@i...
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged
spam]

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.