XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] question about xml:base value generated by xi:include

Note that this has been discussed on the Saxon forum at

https://saxonica.plan.io/issues/3864

and

https://saxonica.plan.io/issues/3530

and I previously raised questions on xml-dev in the thread at 


The current status in Saxon (I believe) is that I found a fix for the problem which I implemented on the development branch, but which I felt was too risky for the 9.8 (or earlier) branch. Part of the problem is that it's the kind of thing that should really be tested against multiple XML parsers, and we only get around to that quite rarely (in fact, it hasn't been done for a while, given how stable the XML parser scene is).

Michael Kay
Saxonica

On 31 Jul 2018, at 13:59, Marco Randazzo <Marco.Randazzo@iit.it> wrote:

Dear all,
I have a question about the value of attribute xml:base generated when processing an xi:include. Let me explain it with an example.
My example employs xi:include elements to include other xml files. It is constituted by a main.xml file which includes another file (include1.xml) stored in a subfolder, called include1.
include1.xml, in turn, includes another xml file (include2.xml) stored in a subfolder of include1 which is called include2.
Overall, the example consists of four folder levels and only the last file, include4.xml, contains data.
This is the contents of the files:
 
./main.xml
<?xml version="1.0" encoding="UTF-8" ?>
    <xi:include href="" />
</main > 
 
/include1/include1.xml
<?xml version="1.0" encoding="UTF-8" ?>
<level1  xmlns:xi="http://www.w3.org/2001/XInclude">
               <xi:include href="" />
</level1 > 
 
./include1/include2/include2.xml
<?xml version="1.0" encoding="UTF-8" ?>
<level2  xmlns:xi="http://www.w3.org/2001/XInclude">
               <xi:include href="" />
</level2 > 
 
./include1/include2/include3/include3.xml
<?xml version="1.0" encoding="UTF-8" ?>
<level3  xmlns:xi="http://www.w3.org/2001/XInclude">
               <xi:include href="" />
</level3 > 
 
./include1/include2/include3/include4/include4.xml
<?xml version="1.0" encoding="UTF-8" ?>
<level4  xmlns:xi="http://www.w3.org/2001/XInclude">
    <data> 0 </data>
    <data> 1 </data>
</level4 > 
 
When I process main.xml, I obtain the following result:
 
  <level1 xml:base="./include1/include1.xml">
    <level2 xml:base="./include1/include2/include2.xml">
      <level3 xml:base="./include2/include3/include3.xml">
        <level4 xml:base="./include3/include4/include4.xml">
          <data>0</data>
          <data>1</data>
        </level4>
      </level3>
    </level2>
  </level1>
</main> 
 
The xml tree is correct, but I have doubts about the value of the attribute xml:base.
In particular:
- level1: I think that the value of xml:base  ( i.e. ./include1/include1.xml) is correct.
- level2: xml:base  value is correct if its meaning is a path relative to the root file. Otherwise, if xml:base is supposed to store a path relative to the current file, then it should be  ./include2/include2.xml.
- level3: This seems to be not correct, neither as an absolute path, nor as a relative path. I think it should be  ./include1/include2/include3/include3.xml as a path relative to the root file or ./include3/include3.xml as a path relative to the current file.
- level4: Same as level3.
 
I also tried to execute a Xquery command http://www.xqueryfunctions.com/xq/fn_base-uri.html on the output.
The result returned by base-uri(//level3) is:
which I think is wrong, I think it should be:
 
I thus suspect that either the implementation of how xi:include generates the value of xml:base or the implementation of base-uri function has a problem.
My suspect is on xi:include. What do you think?
I currently experienced the same strange behavior on two different XML/XQuery processors, i.e.
- baseX http://basex.org (wrapping SAX xml library)
- Saxon EE 9.7 https://www.saxonica.com/download/java.xml



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS