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"?>
<doc/>

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"/>
</p:decare-step>

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

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 22 September 2011 08:04:38 GMT