Re: [xml] XInclude and xml:base attribute

On Thu, Jul 24, 2003 at 10:15:45AM +0200, Manuel González Castro wrote:
  I can't see why your code would change that behaviour compared to

Sorry, after some experiments I've checked that my code and xmllint do always
the same. My problem was with the file paths: 

  ah, okay, I was surprized...

It seems that xml:base is not added if the document source is a bare file name
("in.xml"), and it's added if the source has directories ("dir/in.xml"), even
if the XIncluded resource is in the same directory ("dir/included.xml").  

  Hum, okay, that could qualify as a bug.

For practical purposes this means that xml:base will be added often when
processing XML documents. 

  Well XInclude requires to add it, at least when needed to not break
the URI References made from the document. Please read the XInclude spec.

I'd like to disable the xml:base attribute addition (even if the included
resource is in a different directory) because after performing the XInclude
processing with libxml2 I need to validate the resulting document against a XML
Schema using another library: the xml:base attributes (which can appear in any
element) make the document not valid. I think this is a common problem with
XInclude processing followed by validation.     

Is there any way to control / disable the "xml:base" addittion?

  So you prefer an incorrect but valid document, to a semantically correct
but invalid document. I think there is a problem there...
  Basically xml:base must be added at the XInclude phase so that references
made from the resulting document are not broken. This is not optional in
the XInclude processing and I'm not sure I want to offer a non-compliant
option. At this point XInclude is not yet a W3C Recommendation (though
we expect this will occur soon), I have heard similar user feedback from
other implementors, maybe that's one of the points where the spec is a bit
too drastic.
  In the specific case you explain it seems the xml:base doesn't need to be 
added though I'm not 100% sure without seeing the documents, I know the
algorithm for computing the base should be improved, and that will have to be
fixed at some point. 


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]