Greetings.

This code:

import xml.etree.ElementTree as ET

e_feed = ET.Element("feed")
e_feed.set("xmlns", "http://www.w3.org/2005/Atom";)
xslt_reference = ET.ProcessingInstruction(
    "xml-stylesheet",
    "type=\"text/xml\" href=\"stylesheet.xsl\"")
e_feed.insert(0, xslt_reference)

Would yield this result:

<feed xmlns="http://www.w3.org/2005/Atom";>
<?xml-stylesheet type="text/xml" href="stylesheet.xsl"?>
</feed>

Would it be sensible to allow a negative value:

e_feed.insert(-1, xslt_reference)

So that the result be:

<?xml-stylesheet type="text/xml" href="stylesheet.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom";>
</feed>

Regards,
Schimon
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3//lists/lxml.python.org
Member address: arch...@mail-archive.com

Reply via email to