element.base shows parent file when xinclude is used
Bug #1785224 reported by
Andreas Hagmann
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Triaged
|
Undecided
|
Unassigned |
Bug Description
Versions:
Python : sys.version_
lxml.etree : (4, 2, 1, 0)
libxml used : (2, 9, 8)
libxml compiled : (2, 9, 8)
libxslt used : (1, 1, 32)
libxslt compiled : (1, 1, 32)
Using an XML with xi:include and parse it with xinclude() results in wrong 'base' attribute for elements in the included file. The 'base' shows the root document instead of the included ones. The 'sourceline' attribute seems to be correct.
The attached example gives:
sheets /tmp/lxml/root.xml 3
sheet /tmp/lxml/root.xml 1
expected is:
sheets /tmp/lxml/root.xml 3
sheet /tmp/lxml/inc.xml 1
To post a comment you must log in.
XInclude is implemented in libxml2 and not in lxml. However, lxml could probably work around this somehow by setting "xml:base" attributes in the tree after processing. The original XInclude markers are kept in the tree, so this might be possible as a post-processing step.
PR welcome.