element.base shows parent file when xinclude is used

Bug #1785224 reported by Andreas Hagmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Triaged
Undecided
Unassigned

Bug Description

Versions:
Python : sys.version_info(major=3, minor=4, micro=6, releaselevel='final', serial=0)
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

Revision history for this message
Andreas Hagmann (andreash2018) wrote :
Revision history for this message
scoder (scoder) wrote :

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.

Changed in lxml:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.