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 Danny Ayers <da...@virgilio.it> on 2002/01/16 21:49:04 UTC

CSSs with JSVGCanvas

Basically what I'm wanting to do is to use an external CSS with JSVGCanvas,
in a way in which 1. the canvas is rendered according to the CSS, and 2.
where I can get at the values supplied by the CSS.

Initially I was adding the PI into the doc using the DOM, and though when
serialised this worked fine in the Adobe viewer, the Swing component was
unaware. Ok, on reading the doc a bit I realised that this was a
non-starter, so I've just been trying :

	SVGOMDocument svgDoc = (SVGOMDocument)doc;
	...
	String css_pi = " href=\""+cssFile+"\" type=\"text/css\"";
	...
	ssi =
(SVGStyleSheetProcessingInstruction)svgDoc.createProcessingInstruction("xml-
stylesheet", css_pi);
	svgDoc.insertBefore(ssi, firstNode);

(I got a little confused on
SVGOMDocument.createProcessingInstruction(target, data), in the doc it
says -

	Returns:
	a SVGStyleSheetProcessingInstruction if target is "xml-stylesheet" or a
GenericProcessingInstruction otherwise.

it actually returns a org.w3c.dom.ProcessingInstruction, hence the cast
above)

But again, the canvas & SVGOMDocument seem unaware of the CSS, but it still
displays fine in IE + plugin.

svgDoc.getStyleSheets(); gives me nowt.

Obviously I'm doing something wrong, so I decided to check out something
that was known to work. I launched the Batik browser and tried attaching the
CSS (in the Preferences menu). Unfortunately :

org.w3c.dom.DOMException: The document located at
"H:\isacat_code\orgn\css\xt.css" represents an invalid CSS document.
Unable to make sense of URL for connection 	at
org.apache.batik.css.CSSDOMExceptionFactory.createDOMException(Unknown
Source)
There's nothing fancy in the CSS or the SVG (though "Unable to make sense of
URL" would seem to suggest a different issue anyway).

Help would be greatly appreciated!!!

Cheers,
Danny.


---

Danny Ayers
<stuff> http://www.isacat.net </stuff>


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