[lxml-dev] Working with <?xml-stylesheet ... ?>

Martin Aspeli optilude at gmx.net
Wed Dec 31 02:39:02 CET 2008


Hi,

I'd like to quickly/efficiently get a list of all <?xml-stylesheet ?> 
processing instructions in a given document.

I have managed to find it via root_tree.getprevious(), but it seems I 
need to search through the siblings here to find the <?xml-stylesheet ?> 
if indeed there is one.

I'm using the HTML parser.

Is there a more natural API?

Also, serialising using lxml.html.tostring() seems to lose the 
<?xml-stylesheet ?> PI. Is this by design?

Cheers,
Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the lxml-dev mailing list