Try something like

        newdoc.insertBefore(pi, newdoc.getFirstChild())

> -----Original Message-----
> From: Randy George [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 16, 2002 6:56 PM
> To: [EMAIL PROTECTED]
> Subject: Re: creating ProcessingInstruction 
> 
> 
> Hello,
> 
>     I am trying to add a processing instruction to a document similar to
> this:
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
>                      "http://www.w3.org/TR/SVG/DTD/svg10.dtd";>
> <?xml-stylesheet href="focus.css" type="text/css"?>
> <svg width="150" height="450" preserveAspectRatio="xMinYMin" viewBox="0 0
> 150 450"
>       xmlns="http://www.w3.org/2000/svg";>
>                       .
>                       .
> 
> 
>    However I can't seem to find a way to add the ProcessingInstruction
> before the svgdocument. The following approach will not work since the pi
> will always be after the root svg element and only seems to work if it is
> before?
>                       .
>                       .
>       DOMImplementation dm = builder.getDOMImplementation();
>       Document newdoc = dm.createDocument(null,"svg",null);
> 
>       ProcessingInstruction pi =
> newdoc.createProcessingInstruction("xml-stylesheet","href=\"focus.css\"
> type=\"text/css\"");
>       newdoc.appendChild(pi);
>                       .
>                       .
> 
>   Any clues will be appreciated by the clueless :)
> 
> Thanks
> Randy George
> www.web-maps.com
> SVG for Mapping!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to