[XML-SIG] createProcessingInstruction

Andrew Clover and-xml at doxdesk.com
Thu Dec 16 01:27:47 CET 2004

Derek Basch <dbasch at yahoo.com> wrote:

> It places the XSL Style Sheet reference at the end the generated XML
> instead of the beginning.

> 	doc = imp.createDocument("", 'receipt', doctype)
> 	doc.appendChild(doc.createProcessingInstruction(...))

The PI node is appended to the end of the Document node, after the root 
Element (which is created implicitly by the createDocument method).

To put the PI first in the Document's childNodes:

   pi= doc.createProcessingInstruction(...)
   doc.insertBefore(pi, doc.documentElement)

Andrew Clover
mailto:and at doxdesk.com

More information about the XML-SIG mailing list