W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > September 2011

Re: document base uri

From: Norman Walsh <ndw@nwalsh.com>
Date: Thu, 22 Sep 2011 08:12:08 +0100
To: public-xml-processing-model-comments@w3.org
Message-ID: <m2ty85dp9z.fsf@nwalsh.com>
Romain Deltour <rdeltour@gmail.com> writes:
> I think it would be better to say: if an attribute named "xml:base" is  
> added (or changed), the base URI of the underlying element MUST be  
> updated ; if the underlying element is the root element, the base URI  
> of the document MUST be updated.

I feel your pain. But consider the following document:

<?xml version="1.0">
<?rules href="myrules.rul"?>

In XML, PIs have a base URI, so adding an xml:base attribute to the
"doc" element shouldn't change the base URI of the PI. But PIs don't
have the notion of an XML base attribute, so there's no way to
preserve it.

We could have more complex rules, saying implementations should only
change document base URIs if there are no sibling PIs. Or saying that
the implementation *should* preserve the base URI of the PIs (which
might be possible, I haven't looked at the underlying XML APIs in my
own implementation to see).

That said, I stumbled over this issue occasionally too and it's
made me consider a base URI step:

<p:declare-step type="p:base-uri">
  <p:input port="source"/>
  <p:output port="result"/>
  <p:option name="base-uri" required="true"/>

This step behaves exactly like p:identity, but changes the base URI of
the source document.

                                        Be seeing you,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676

Received on Thursday, 22 September 2011 08:04:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:28:27 UTC