You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Xavid Pretzer <xa...@src.ricoh.co.jp> on 2006/07/20 07:55:45 UTC

Updating style after inserting a stylesheet at runtime?

Hello,

Earlier I received some very useful help about getting the computed 
style of elements.  However, I've run into another problem I'm not sure 
how to solve.  For some of the image processing I'm doing, I want to be 
able to load an SVG file, insert a stylesheet that modifies the elements 
in that file, read some of the resultant characteristics from the 
graphics node, then remove the stylesheet.  However, when I insert a 
stylesheet at runtime, it seems not to affect the computed style and 
shape nodes of elements in the document.  If I make similar changes to 
the presentation elements of individual elements, the effects are 
programmaticly available immediately, but if I insert a "style" element, 
nothing seems to change.

At first I thought this was similar to a problem in the FAQ about 
needing to use an update manager.  However, running the code inside an 
update manager's thread didn't change anything.  When I write the file 
with CSS inserted to disk and open it, the style is applied properly, 
but it seems like there should be a more efficient way than having to 
reload the entire SVG file.  Does anyone have any advice?  I've attached 
a test case that shows what I've been trying to do.

I'm running a recent SVG snapshot on JVM 1.5.0_07 on Microsoft Windows XP.

Thank you for your help,
Xavid

Re: Should