Preserving base URI

Hi all,

In the test suite, there is a test named 'preserve-base-uri-001'. It
tests that the base URI property of the nodes is preserved after you
remove the xml:base attributes (using p:delete).

The test does the following:

<p:pipeline>
  <p:delete match="@xml:base">
    <p:input port="source">
      <doc xml:base="http://example.com/base/">
        <chap xml:base="http://example.com/base/chaps/">
          <para>...</para>
        </chap>
      </doc>
    </p:input>
  </p:delete>

  <p:string-replace match="para/text()">
    <p:with-option name="replace"
 
select="concat('&quot;',p:base-uri(/doc/chap),'&quot;')"/>
  </p:string-replace>
<p:pipeline>

And it is expected to return this document:

<doc>
  <chap>
    <para>http://example.com/base/chaps/</para>
  </chap>
</doc>

My question is: Is this actually correct?

In Section 2.4.1 of the spec, there is a sentence that lists the Infoset
properties that all processors must preserve, one of which is the 'base
URI' property. However, in the very same sentence it also says that this
holds for all steps "except where the semantics of a step explicitly
require changes".

In my view, p:delete is clearly a step that updates the source document.
The problem I have is that I simply don't know what should happen to
document nodes if you remove the xml:base attribute. Suppose I remove
chap/@xml:base in the following example:

<doc xml:base="http://foo.com">
  <chap xml:base="http://bar.com">
    <p>...</p>
  </chap>
</doc>

If the 'base URI' property of the node is to be preserved, the base URIs
of both the 'chap' and 'p' elements will remain "http://bar.com". Or,
should the base URI of 'chap' and 'p' be recalculated so that it is
"http://foo.com" after removing chap/@xml:base?

I just don't know. I can also see similar questions with steps that can
modify or create @xml:base attributes: p:add-xml-base (maybe this one is
OK), p:string-replace, p:add-attribute, p:set-attributes (now I am
wondering: can you actually address/create xml:base with these steps??).


Regards,
Vojtech




Thanks,
Vojtech

Received on Tuesday, 25 November 2008 12:15:10 UTC