Hello,

I am having trouble understanding the behavior of xerces-j (2.9.1)
xml:base fixup.  It appears to me that xerces always inserts an xml:base
attribute which describes the base uri relative to the xinclude document
*before* xinclude resolution, rather than taking into account any
xml:base attributes that are inserted during xinclude resolution, and I
think this is problematic.

For example, in the three files at the bottom of this email, one.xml
includes ../two.xml, which includes ../three.xml.  The output after
xinclude resolution is 

<?xml version='1.0' encoding='UTF-8'?> <test>
  <test xml:base="../two.xml">
    <test xml:base="../../three.xml"> <!-- this is the path to three.xml
from one.xml but it should be the path from ../two.xml since that is the
parent xml:base? -->
    Three.xml
    </test>
   </test>
</test>

I believe that the inner xml:base attribute should be "../three.xml",
which is the correct relative path if the outer xml:base attribute
("../two.xml") is taken into consideration.

Or is what I am seeing the expected/correct behavior?  If so, I'd really
appreciate it if someone could provide an explanation.

I have a simple test program and the test files that show this behavior
(using an xinclude-aware SAX parser to echo to the console).  Let me
know if you would like to me to send it to you.

Thanks in advance,
Stuart

Stuart Norton
Document Engineering
Juniper Networks

p.s. here are the 3 sample files:

in file a/b/c/one.xml:
<?xml version="1.0" encoding="UTF-8"?>
<test>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude";
href="../two.xml">
    <xi:fallback>Couldn't find ../two.xml!</xi:fallback>
  </xi:include>
</test>

in file a/b/two.xml:
<?xml version="1.0" encoding="UTF-8"?>
<test>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude";
href="../three.xml">
    <xi:fallback>Couldn't find ../three.xml!</xi:fallback>
  </xi:include>
</test>

in file a/three.xml:
<?xml version="1.0" encoding="UTF-8"?>
<test>
Three.xml
</test>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to