xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Extend CSS in a DOM
Date Mon, 16 Jan 2006 17:56:45 GMT
Hi Simon,

"zze-Urbanisme BECOT S ext RD-TECH-REN" <sbecot.ext@rd.francetelecom.com> 
wrote on 01/16/2006 10:33:38 AM:

> I would like to get an SVG (or XML) document, and extend the CSS styles
> in the DOM. ie, 
> in XML:
> <tag class="toto"/>
> in CSS:
> .toto { attr : value;}
> in output:
> <tag attr="value"/>
> Is there a way to do this with Batik, or do I have to write this process
> myself?

   Batik might help you with some of it but you will need to do
a fair amount of work.  There are a few issues, like CSS is not
'presented' as attribute values it is handled through properties
(one of the things that contributes to property values can be
presentation attributes, like "attr" above).  So you would have
to walk the tree checking the property values on each element
and creating attributes for them.  This is made a little tricker
as CSS says that all properties are defined on all elements 
(primarily for inheritance) so a simple minded approach would lead
to every element having every attribute set... Perhaps not what you

   There are also some other issues like Batik doesn't currently
bother to do the CSS cascade for 'generic' XML elements (since they
can't contribute to the SVG display).  For a given grammar this
isn't hard to fix but it would need to be done.  Also you would have
to inform the CSS engine of the properties you want it to handle
once again for a given grammar not that hard to do.

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message