[lxml-dev] Adding a Stylesheet PI when creating new XML documents

Stefan Behnel stefan_ml at behnel.de
Thu Mar 22 20:22:35 CET 2007


Hi!

Lee Brown wrote:
> Parsing an XSLT stylesheet from an xml-stylesheet PI is working just
> fine, but now I'm trying to add an xml-stylesheet PI to a new XML tree
> created from within lxml.  I've looked back through the list traffic and
> done some code introspection but I can't find anything.
> 
> Did we ever decide upon / create an API for adding a stylesheet PI to a
> new tree?

No, not yet. :)

I see two possibilities: add a "prependPI(pi)" method to ElementTree, or add a
method "addToTree(tree)" method to ProcessingInstruction. We might then also
need a way to get rid of them again - although, well, you could always move
them to a different tree, which would obviously remove them from the current one.

Ok, so any preferences?

Stefan


More information about the lxml-dev mailing list