W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > May 2007

RE: Found a solution for CSS -> XML mapping: JXCSS

From: James Pearce <jpearce@mtld.mobi>
Date: Fri, 11 May 2007 08:18:06 +0100
Message-ID: <C8FFD98530207F40BD8D2CAD608B50B42B3D78@mtldsvr01.DotMobi.local>
To: <public-mobileok-checker@w3.org>

Concise it ain't ;-) but complete.

Although if the namespace was implicit on all the descendant nodes it
wouldn't actually be too bad.

(Ditto for all the namespace-uri="" attributes if these could be
defaulted in the schema)

JP

-----Original Message-----
From: public-mobileok-checker-request@w3.org
[mailto:public-mobileok-checker-request@w3.org] On Behalf Of Sean Owen
Sent: 11 May 2007 00:43
To: public-mobileok-checker@w3.org
Subject: Found a solution for CSS -> XML mapping: JXCSS


https://jxcss.dev.java.net/

I found this gem on the internet. I've included a sample stylesheet and
what it spits out. Looks pretty good to me -- as decent as the
"css:chunk" business suggested by that W3C technical note of 1998. Any
objections to sticking this into the code as the default means of
generating a DOM from the CSS?


a, a:visited {color: green}
body, td, th {font-family: Verdana,sans-serif} td, th {text-align: left;
vertical-align: top; padding: 0.1cm 0.3cm 0.1cm 0.3cm} th
{vertical-align: bottom; font-weight: bold;} pre {color: #003300;
border: 1px solid black; padding: 0.1cm;
background-color: #DDDDDD}
code {color: #003300}
img {border: 0}
h2, h3 {padding-top: 0.1cm}

.verylarge {font-size: 400%}
.halfwidth {width: 50%}
.centertext {text-align: center}


<?xml version="1.0" encoding="UTF-8"?>
<xcss:css-stylesheet xmlns:xcss="xcss/1.0"> <xcss:style>
<xcss:element-node-selector local-name="a" namespace-uri=""/>
<xcss:conditional-selector> <xcss:selector> <xcss:element-node-selector
local-name="a" namespace-uri=""/> </xcss:selector>
<xcss:pseudo-class-condition local-name="" namespace-uri=""
specified="false">visited</xcss:pseudo-class-condition>
</xcss:conditional-selector>
<xcss:property name="color">
<xcss:value type="string">green</xcss:value> </xcss:property>
</xcss:style> <xcss:style> <xcss:element-node-selector local-name="body"
namespace-uri=""/> <xcss:element-node-selector local-name="td"
namespace-uri=""/> <xcss:element-node-selector local-name="th"
namespace-uri=""/> <xcss:property name="font-family"> <xcss:value
type="string">Verdana</xcss:value>
<xcss:value type="string">sans-serif</xcss:value>
</xcss:property>
</xcss:style>
<xcss:style>
<xcss:element-node-selector local-name="td" namespace-uri=""/>
<xcss:element-node-selector local-name="th" namespace-uri=""/>
<xcss:property name="text-align"> <xcss:value
type="string">left</xcss:value> </xcss:property> <xcss:property
name="vertical-align"> <xcss:value type="string">top</xcss:value>
</xcss:property> <xcss:property name="padding"> <xcss:value type="float"
unit="cm">0.1</xcss:value> <xcss:value type="float"
unit="cm">0.3</xcss:value> <xcss:value type="float"
unit="cm">0.1</xcss:value> <xcss:value type="float"
unit="cm">0.3</xcss:value> </xcss:property> </xcss:style> <xcss:style>
<xcss:element-node-selector local-name="th" namespace-uri=""/>
<xcss:property name="vertical-align"> <xcss:value
type="string">bottom</xcss:value> </xcss:property> <xcss:property
name="font-weight"> <xcss:value type="string">bold</xcss:value>
</xcss:property> </xcss:style> <xcss:style> <xcss:element-node-selector
local-name="pre" namespace-uri=""/> <xcss:property name="color">
<xcss:function name="rgb"> <xcss:value type="integer">0</xcss:value>
<xcss:value type="integer">51</xcss:value> <xcss:value
type="integer">0</xcss:value> </xcss:function> </xcss:property>
<xcss:property name="border"> <xcss:value type="float"
unit="px">1.0</xcss:value> <xcss:value type="string">solid</xcss:value>
<xcss:value type="string">black</xcss:value> </xcss:property>
<xcss:property name="padding"> <xcss:value type="float"
unit="cm">0.1</xcss:value> </xcss:property> <xcss:property
name="background-color"> <xcss:function name="rgb"> <xcss:value
type="integer">221</xcss:value> <xcss:value
type="integer">221</xcss:value> <xcss:value
type="integer">221</xcss:value> </xcss:function> </xcss:property>
</xcss:style> <xcss:style> <xcss:element-node-selector local-name="code"
namespace-uri=""/> <xcss:property name="color"> <xcss:function
name="rgb"> <xcss:value type="integer">0</xcss:value> <xcss:value
type="integer">51</xcss:value> <xcss:value type="integer">0</xcss:value>
</xcss:function> </xcss:property> </xcss:style> <xcss:style>
<xcss:element-node-selector local-name="img" namespace-uri=""/>
<xcss:property name="border"> <xcss:value type="integer">0</xcss:value>
</xcss:property> </xcss:style> <xcss:style> <xcss:element-node-selector
local-name="h2" namespace-uri=""/> <xcss:element-node-selector
local-name="h3" namespace-uri=""/> <xcss:property name="padding-top">
<xcss:value type="float" unit="cm">0.1</xcss:value> </xcss:property>
</xcss:style> <xcss:style> <xcss:conditional-selector> <xcss:selector>
<xcss:element-node-selector local-name="" namespace-uri=""/>
</xcss:selector> <xcss:class-condition local-name="class"
namespace-uri=""
specified="true">verylarge</xcss:class-condition>
</xcss:conditional-selector>
<xcss:property name="font-size">
<xcss:value type="float" unit="%">400.0</xcss:value> </xcss:property>
</xcss:style> <xcss:style> <xcss:conditional-selector> <xcss:selector>
<xcss:element-node-selector local-name="" namespace-uri=""/>
</xcss:selector> <xcss:class-condition local-name="class"
namespace-uri=""
specified="true">halfwidth</xcss:class-condition>
</xcss:conditional-selector>
<xcss:property name="width">
<xcss:value type="float" unit="%">50.0</xcss:value> </xcss:property>
</xcss:style> <xcss:style> <xcss:conditional-selector> <xcss:selector>
<xcss:element-node-selector local-name="" namespace-uri=""/>
</xcss:selector> <xcss:class-condition local-name="class"
namespace-uri=""
specified="true">centertext</xcss:class-condition>
</xcss:conditional-selector>
<xcss:property name="text-align">
<xcss:value type="string">center</xcss:value> </xcss:property>
</xcss:style> </xcss:css-stylesheet>
Received on Friday, 11 May 2007 07:18:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:03 GMT