[lxml-dev] Processing instruction doubt

Steve Howe howesteve at gmail.com
Wed Dec 20 10:04:32 CET 2006


Hello all,

This should be rather a stupid question, but supposing I have an ElementTree 
instance, and I want to add a processing instruction to it - in my case, a 
xml-stylesheet PI - how do I add that PI in the correct location of the tree 
(i.e. before the root) without serializing ?

<?xml-stylesheet type="text/xsl" href="stylesheet.xsl">
<data>
  ...
</data>

Before someone answers "add the PI into the XSLT before serializing it", the 
ElementTree is received by a function from an end user and I have no control 
over what's received.

Thanks.
-- 
Best Regards,
Steve Howe


More information about the lxml-dev mailing list