Hi, I realized libxml2 has a feature optimizing xml:base fixup for XInclude, which impacts lxml.etree._Element base and sourceline attributes. If a document is including another document in the same directory, an xml:base fixup strictly speaking is not needed, as any relative URI in the included part will resolve correctly. And that, in the eyes of libxml2, seems to be the primary stated purpose for xml:base. The optimization leads to a smaller overall document, which seems to be considered a feature, usefull to keep the document small and uncluttered when including many small fragments. Now there is this secondary purpose of xml:base, telling the original document of any element in the expanded, xinclude processed document. I personally find that extremely usefull, and it's actually what makes the lxml.etree._Element base/sourceline attributes so elegant. Except that it currently only works if the files change directory at every xinclude level, to work around aforementioned libxml2 optimization. I have submitted two patches to the libxml2 mailing list, the first one would just make it work (and disable the optimization) the second one adds a run time option, which would need a corresponding fix in lxml. If you are involved in libxml2, feel free to share your opinion there, thx, S. -- Susanne Oberhauser SUSE LINUX Products GmbH +49-911-74053-574 Maxfeldstraße 5 Processes and Infrastructure 90409 Nürnberg GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
participants (1)
-
Susanne Oberhauser-Hirschoff