Re: document base uri

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 UTC