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 Thursday, 10 May 2007 23:43:21 UTC