Hi,
-> Is there a way to get lxml's HTML serialization support to produce the explicitly closed form ?
I actually found a solution to this problem, by specifying more parameters to the etree.tostring() function: fp.write(etree.tostring(out_tree, encoding="utf-8", method="html", xml_declaration=None, pretty_print=False, with_tail=True, standalone=None, doctype='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">')) However, this means that the output parameters specified in the XSLT become meaningless, because they are overwritten in the Python program. -> Is there a way to let lxml honor the output parameters specified in the XSLT ? It seems to me that would be a good default behavior. -> Also, is there a way to get any HTML comments in the element tree to be serialized ? The tostring() parameter with_comments is documented to apply to the C14N output method only, and does not cause the HTML comments to be created when set to True. Andy