xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helder Magalhães <helder.magalh...@gmail.com>
Subject Re: Reload Style Sheet
Date Thu, 18 Feb 2010 06:49:56 GMT
Hi vyang,

> I'm wondering if there is another way for JSVGCanvas to reload an external
> style sheet without having to reset the canvas document ie calling
> setSVGDocument().

Probably. ;-)

I'm not into the details as I never needed to do such thing, nor I
properly checked if Batik provides convenience methods for achieving
that but you seem to have several ways [1] of loading a style sheet.
So, while perhaps you *may* be able to rework the XML PI (in theory
it's not part of the document so I'm not sure how can one access it as
it shouldn't be in the DOM -- didn't check/test for this theory,
though), I'm not sure if Batik (and other implementations) will behave
properly when messing with the document this way. I'd recommend
dynamically inserting a link, using the DOM, which changes the
external style sheet definition:

  <style type="text/css">@import url(svgstyle.css);</style>

Note that, when using this approach (also found in the already stated
link [1]), the previous style sheet will still be active, you'll
simply be inserting a new one. This means that one should be careful
to ensure that all declarations, or at least all the ones you which to
"reload", are in the several available style sheets (so that they
override previous definitions).

Hope this helps,

[1] http://schepers.cc/?p=82

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

View raw message