[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: question about xml:base value generated by xi:include

  • From: Michael Kay <mike@saxonica.com>
  • To: Marco Randazzo <Marco.Randazzo@iit.it>
  • Date: Tue, 31 Jul 2018 15:37:24 +0100

Re:  question about xml:base value generated by xi:include
Note that this has been discussed on the Saxon forum at


and


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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.