GNOME Bugzilla – Bug 129965
xinclude 2003, missed xml:base
Last modified: 2009-08-15 18:40:50 UTC
Code is from CVS, dated by 24 Devember 2003. Source XML: ----- <document.xml> <?xml version='1.0'?> <document xmlns:xi="http://www.w3.org/2003/XInclude"> <p>120 Mz is adequate for an average home user.</p> <xi:include href="disclaimer.xml"/> </document> ----- </document.xml> ----- <disclaimer.xml> <?xml version='1.0'?> <disclaimer> <p>The opinions represented herein represent those of the individual and should not be interpreted as official policy endorsed by this organization.</p> </disclaimer> ----- </disclaimer.xml> After processing XIncludes: ----- <result> <?xml version="1.0"?> <document xmlns:xi="http://www.w3.org/2003/XInclude"> <p>120 Mz is adequate for an average home user.</p> <disclaimer> <p>The opinions represented herein represent those of the individual and should not be interpreted as official policy endorsed by this organization.</p> </disclaimer> </document> ----- </result> but ----- <expected> <?xml version='1.0'?> <document xmlns:xi="http://www.w3.org/2003/XInclude"> <p>120 Mz is adequate for an average home user.</p> <disclaimer xml:base="http://www.example.org/disclaimer.xml"> <p>The opinions represented herein represent those of the individual and should not be interpreted as official policy endorsed by this organization.</p> </disclaimer> </document> ----- </expected> It is expected that element "disclaimer" gets attribute "xsl:base", but it is not so.
The output of xml:base only takes place if the base URI of the included infoset is different than the URI of the document into which it is being included. In your example, if you move disclaimer.xml to a different directory (and, of course, change the href in document.xml) it should behave as you expect. I believe this in in accordance with 4.5.5 of the specification. Bill
> included infoset is different than the URI of the document It is exactly so. According to my understanding of the standard, base URI of document is "document.xml" and base URI of acquired infoset is "disclaimer.xml". So "xml:base" should appear, because base URI have no any relations to directories, at least in XInclude standard. I'm not re-opening due to going unsure. I have to consult with others. By the way, this test case is an example 'C-1' from XInclude specification.
The base is not the same, but when building an URI Reference they will lead to the same resulting URL, so adding an xml:base (not xsl:base !) is not needed in practice, that's my understanding of both that example and of the spec... Daniel
Looking at www-xml-xinclude-comments archives, I found a similar question: http://lists.w3.org/Archives/Public/www-xml-xinclude-comments/2003Jun/0029.html <quote> In your provided correct result, is the xml:base attribute on the second <root> element strictly necessary, since inc1.xml is in the same directory as test.xml? </quote> And answer similar to Daniel's comment: http://lists.w3.org/Archives/Public/www-xml-xinclude-comments/2003Jun/0030.html <quote> We're still pursing that question the WG. Strictly speaking, the base URI of the document is presumably something like file:///d:XMLBaseTest/main.xml. This is not character-for-character equivalent, and the spec says an xml:base attribute is added if the two values are "different". If we clarify "different" to mean "not equivalent for purposes of absolutization according to RFC 2396", </quote> With this clarification of "different", dropping of "xml:base" in this issue is fully correct and bug 129965 is really NOTABUG. Closing.