[xml] Problem keeping track of the base URI of included documents



Hello,

I am having problems getting my references right when using libxml with xinclude.
I have a 3 files, in two separate directories (given here relatively to the current directory) :
   test.xml
   somewhere/other.xml
   somewhere/hello

with the following contents :

<!-- test.xml -->
<?xml version="1.0" encoding="iso-8859-1"?>
<test xmlns:xi="http://www.w3.org/2001/XInclude">
   <xi:include href="" />
</test>

<!-- somewhere/other.xml -->
<?xml version="1.0" encoding="iso-8859-1" ?>
<just-a-test>
   <myref href="" />
</just-a-test>

the content of hello doesn't matter

Why expanding the xinclude nodes in test.xml we get the folling document
<!-- result of 'xmllint --xinclude test.xml' --->
<?xml version="1.0" encoding="iso-8859-1"?>
<test xmlns:xi="http://www.w3.org/2001/XInclude">
   <just-a-test>
   <myref href=""
</just-a-test>
</test>

After the inclusion my reference to the file hello is wrong since the base URI of test.xml and other.xml is not the same. As I understood it in the W3C specifiation of XInclude(http://www.w3.org/TR/xinclude/#base) an xml:base attribute infoset should have been added to the toplevel included items (in my case the <just-a-test> element).

Is this a bug in libxml2 (I have version 2.4.16) or did I misunderstand or miss something in the specifiation ?

In the second case what solution do I have to solve my problem knowing that my objective is only to do an xsl transformation (I could write a program solving the problem but that solution doesn't satisfy me since it is not generic).

Thank you in advance for your help,
Benjamin
--
Benjamin Habegger
Doctorant Allocataire MR/Moniteur
IRIN, 2 rue de la Houssiniere, BP92208, 44322 Nantes Cedex 3
Tel : 02 51 12 58 42 - Fax : 02 51 12 58 12
Mel : Benjamin Habegger irin univ-nantes fr
WWW: http://www.sciences.univ-nantes.fr/info/perso/permanents/habegger/


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