Next in thread → Next in month →

Re: [xml-dev] A problem with Base URI and nested XIncludes

From
Liam R. E. Quin <>
To
Michael Kay <>, XML Developers List <>
Date
2019-08-14T16:58:22Z
ID
<>
Thread
Re: [xml-dev] A problem with Base URI and nested XIncludes
On Wed, 2019-08-14 at 12:37 +0100, Michael Kay wrote:
> 
> The spec for xml:base says (§4.3) The base URI for a URI reference
> appearing in an xml:base attribute is the base URI of the parent
> element of the element bearing the xml:base attribute, if one exists
> within the document entity or external entity, otherwise the base URI
> of the document entity or external entity containing the element.

The xml:base spec should have been modified to take XInclude into
account, but i don't think any of us thought of it. Instead, the
XInclude spec includes text about base URI fixup - see below.

In general of course, the goal is that the xml:base property of any
element always tells you where that element came from. The underlying
assumption is that the only boundary points at which the base property
changes are the "edges" of expanded file (external parsed) entities and
the outermost document itself, but XInclude breaks that assumption.

What makes most sense to me is to treat your example as,
<!ENTITY c1 SYSTEM "subfolder/child.xml">
<!ENTITY c2 SYSTEM "otherchild.xml">

with subfolder/child.xml looking like:
<child>&c2;</child>

So, the base attrbute is recording for applications the history of how
the document was constructed.

> Would anyone argue that the Xerces output is correct?

Yes, because XInclude includes a section, Base URI Fixup.

See
https://www.w3.org/TR/xinclude/#base
and more recent prose at
https://www.w3.org/TR/xinclude-11/#base
(but the XML Core Working Group was closed before this could become a
Recommendation).

Liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Web slave for vintage clipart http://www.fromoldbooks.org/
Next in thread → Next in month →