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 Sanne de Roever <sa...@newfoundland.nl> on 2003/08/23 14:21:28 UTC

Newbie: inserting stylesheet into DOM

Hi,

Well I must be DOM (Dutch for dumb).
I want to insert a stylesheet reference into a DOM document:

DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Document doc = impl.createDocument(svgNS, "svg", null);
ProcessingInstruction PI = doc.createProcessingInstruction("xml-stylesheet",
"type=\"text/css\" href=\"svg.css\" ?>");
doc.appendChild(PI);

But now the stylesheet ends up last, and doesn't work.
My SVG are beautifull, but I have to move the stylesheet reference manually!

Can anybody help me out?

Sanne



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


Re: Newbie: inserting stylesheet into DOM

Posted by Sanne de Roever <sa...@newfoundland.nl>.
Hi Thomas,

Thanks a million! Before I tried:

        //doc.insertBefore(doc.getDocumentElement(),PI);

And that didn't work, and I became frustrated. But ...
it's the other way around. I'm happy!
My table building library seems to get working.

Although the layout is not yet ok., and the font is Gill Sans, maybe you'll
get an impression of the result. Hundreds of chart/tables etc. need to be
printed from a DB for a book, and it is done automagically thanks to SVG.

Thanks!

Kind regards,

Sanne
----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Saturday, August 23, 2003 3:21 PM
Subject: Re: Newbie: inserting stylesheet into DOM


> Sanne de Roever wrote:
> > Hi,
> >
> > Well I must be DOM (Dutch for dumb).
> > I want to insert a stylesheet reference into a DOM document:
> >
> > DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
> > String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
> > Document doc = impl.createDocument(svgNS, "svg", null);
> > ProcessingInstruction PI =
doc.createProcessingInstruction("xml-stylesheet",
> > "type=\"text/css\" href=\"svg.css\" ?>");
> > doc.appendChild(PI);
> >
> > But now the stylesheet ends up last, and doesn't work.
> > My SVG are beautifull, but I have to move the stylesheet reference
manually!
> >
> > Can anybody help me out?
>
>    Try:
>
> doc.insertBefore(PI, doc.getRootElement());
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>

Re: Newbie: inserting stylesheet into DOM

Posted by Thomas DeWeese <Th...@Kodak.com>.
Sanne de Roever wrote:
> Hi,
> 
> Well I must be DOM (Dutch for dumb).
> I want to insert a stylesheet reference into a DOM document:
> 
> DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
> String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
> Document doc = impl.createDocument(svgNS, "svg", null);
> ProcessingInstruction PI = doc.createProcessingInstruction("xml-stylesheet",
> "type=\"text/css\" href=\"svg.css\" ?>");
> doc.appendChild(PI);
> 
> But now the stylesheet ends up last, and doesn't work.
> My SVG are beautifull, but I have to move the stylesheet reference manually!
> 
> Can anybody help me out?

   Try:

	doc.insertBefore(PI, doc.getRootElement());





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