Re: XInclude internal references and ID clashes processing

Frederik De Keukelaere wrote:

> If I am not mistaken the example below should be correct according to the
> XInclude specification.

It's correct, but won't work.

> <?xml version="1.0" encoding="UTF-8"?>
> <root xmlns:xi="http://www.w3.org/2001/XInclude">
>   <Declaration>
>     <Text id="copyright">Copyright MyCompany.</Text>
>   </Declaration>
>   <Instantiation>
>     <xi:include xpointer="copyright"/>
>     <xi:include xpointer="copyright"/>		
>   </Instantiation>
> </root>

"copyright" in xpoiner attribute represents a shorthand XPointer pointer 
[1] which depends on schema or DTD defined ID. In your document id 
attribute isn't defined as ID typed, so xpointer="copyright" locates 
nothing, which is resource error becoming fatal error when no 
xi:fallback is provided.

With id attribute defined as ID it works just fine with libxml2:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ATTLIST Text id ID #REQUIRED>
]>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
   <Declaration>
     <Text id="copyright">Copyright MyCompany.</Text>
   </Declaration>
   <Instantiation>
     <xi:include xpointer="copyright"/>
     <xi:include xpointer="copyright"/>		
   </Instantiation>
</root>

[1] http://www.w3.org/TR/xptr-framework/#shorthand

-- 
Oleg Tkachenko
http://blog.tkachenko.com

Received on Monday, 6 June 2005 07:44:34 UTC