Martin Aspeli wrote:
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?
Mmmm.... and another thing: once I get the HtmlProcessingInstruction node, how can I get the value of its pseudo-attributes (href and type, in this case)? The attr dict is empty... Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book