[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

A problem with Base URI and nested XIncludes

  • From: Michael Kay <mike@saxonica.com>
  • To: XML Developers List <xml-dev@lists.xml.org>
  • Date: Wed, 14 Aug 2019 12:37:10 +0100

A problem with Base URI and nested XIncludes
Further details of this problem can be found here:


We have the following structure:

root.xml:

<root xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="subfolder/child.xml"/>
</root>

subfolder/child.xml:

<child xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="otherchild.xml"/>
</child>

subfolder/otherchild.xml:

<otherchild/>
The Xerces parser (both the Apache and JDK versions) presents Saxon with a document like this:

<root xmlns:xi="...">
   <child xml:base="subfolder/child.xml">
      <otherchild xml:base="subfolder/otherchild.xml"/>
   </child>
</root>
and as a result, Saxon reports the base URI of <otherchild> as xxx/subfolder/subfolder/otherchild.xml. My question is: is Xerces getting this wrong, or is Saxon?

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.

It's a bit hard to interpret that, because by the time the elements have acquired an xml:base attribute, they are no longer part of any document or external entity. But I can only see two possible interpretations: (a) otherchild/@xml:base is resolved against the base URI of the <child> element, which gives the result Saxon is showing, and (b) otherchild/@xml:base is resolved against the base URI of the entity that the <otherchild> element originally came from, which gives exactly the same result.

Would anyone argue that the Xerces output is correct?

Michael Kay
Saxonica


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.