xml:base

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

xml:base

brettz9

Hi,

 From reading the documentation of xml:base, I am left unclear as to
whether xml:base can not only be used on the parent of an element, or
whether its presence on any previous ancestor is enough to trigger the
resolving of relative URIs. This is especially unclear as I see a
previous draft of the document did refer to "the nearest ancestor
element" rather than what seems to me to be a more ambiguous
"encapsulating entity".

thank you,
Brett Zamir


Reply | Threaded
Open this post in threaded view
|

Re: xml:base

Richard Tobin-2

> From reading the documentation of xml:base, I am left unclear as to
> whether xml:base can not only be used on the parent of an element, or
> whether its presence on any previous ancestor is enough to trigger the
> resolving of relative URIs. This is especially unclear as I see a
> previous draft of the document did refer to "the nearest ancestor
> element" rather than what seems to me to be a more ambiguous
> "encapsulating entity".

Section 4.3 states that the base URI used for resolving a relative URI
is that of the element containing it.  Section 4.2 states that the
base URI of an element without an xml:base attribute is that of its
parent element.  So base URIs come from the nearest ancestor with
an xml:base attribute.  (There is an exception when entity boundaries
intervene.)

The phrase "encapsulating entity" appears in case 2 of section 4.1,
and is quoted from RFC3986.  The use of xml:base falls into case 1: it
is a URI embedded in the document's content.  So "encapsulating
entity" has nothing to do with the ancestor elements within the
document.

-- Richard


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


Reply | Threaded
Open this post in threaded view
|

Re: xml:base

Richard Tobin-2

Can you let us know whether you accept our response to your
comment on the XML Base PER:

http://lists.w3.org/Archives/Public/www-xml-linking-comments/2008JulSep/0005.html

-- Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


Reply | Threaded
Open this post in threaded view
|

Re: xml:base

brettz9
Richard Tobin wrote:
Can you let us know whether you accept our response to your
comment on the XML Base PER:

http://lists.w3.org/Archives/Public/www-xml-linking-comments/2008JulSep/0005.html

  
I see (responding to your point about it not being related to ancestor elements). But I was trying to find somewhere where the issue was made explicit as to how xml:base is not only based on the parent, since there are these following lines (and basically only these lines on the topic) which only refer to "parent element" and not clearly to an indefinite number of levels of inheritance of within the document (and regardless of whether xml:base was explicitly present on the parent or not, etc.):

"The base URI of an element is...the base URI of the element's parent element within the document or external entity, if one exists..."

"The base URI for a URI reference appearing in an xml:base attribute is the base URI of the parent element of the element bearing the xml:base attribute, if one exists within the document entity or external entity, otherwise the base URI of the document entity or external entity containing the element."

Maybe that is made clear in other referenced specs, but since this seems to be such a central point of the spec, I would think clarifying that would be helpful.

thank you,
Brett
Reply | Threaded
Open this post in threaded view
|

Re: xml:base

Richard Tobin-2


> I see (responding to your point about it not being related to ancestor
> elements). But I was trying to find somewhere where the issue was made
> explicit as to how xml:base is not only based on the parent, since there
> are these following lines (and basically only these lines on the topic)
> which only refer to "parent element" and not clearly to an indefinite
> number of levels of inheritance of within the document (and regardless
> of whether xml:base was explicitly present on the parent or not, etc.):
>
> "The base URI of an element is...the base URI of the element's parent
> element within the document or external entity, if one exists..."
>
> "The base URI for a URI reference appearing in an |xml:base| attribute
> is the base URI of the parent element of the element bearing the
> |xml:base| attribute, if one exists within the document entity or
> external entity, otherwise the base URI of the document entity or
> external entity containing the element."
>
> Maybe that is made clear in other referenced specs, but since this seems
> to be such a central point of the spec, I would think clarifying that
> would be helpful.

The answer follows from the rules you quote above.  Given

<a xml:base="http://example.com">
  <b>
    <c> ...

the base URI of the <c> element is (by 4.2 part 2) the base URI
of the <b> element.  Similarly, the base URI of the <b> element
is the base URI of the <a> element.  And by 4.2 part 1, the base
URI of the <a> element is "http://example.com".

-- Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


Reply | Threaded
Open this post in threaded view
|

Re: xml:base

brettz9
Richard Tobin wrote:
I see (responding to your point about it not being related to ancestor 
elements). But I was trying to find somewhere where the issue was made 
explicit as to how xml:base is not only based on the parent, since there 
are these following lines (and basically only these lines on the topic) 
which only refer to "parent element" and not clearly to an indefinite 
number of levels of inheritance of within the document (and regardless 
of whether xml:base was explicitly present on the parent or not, etc.):

"The base URI of an element is...the base URI of the element's parent 
element within the document or external entity, if one exists..."

"The base URI for a URI reference appearing in an |xml:base| attribute 
is the base URI of the parent element of the element bearing the 
|xml:base| attribute, if one exists within the document entity or 
external entity, otherwise the base URI of the document entity or 
external entity containing the element."

Maybe that is made clear in other referenced specs, but since this seems 
to be such a central point of the spec, I would think clarifying that 
would be helpful.
    

The answer follows from the rules you quote above.  Given

<a xml:base="http://example.com">
  <b>
    <c> ...

the base URI of the <c> element is (by 4.2 part 2) the base URI
of the <b> element.  Similarly, the base URI of the <b> element
is the base URI of the <a> element.  And by 4.2 part 1, the base
URI of the <a> element is "http://example.com".
  

Yes, I am aware that this is the intention, but by specifying "parent" (without reference to recursion), it raises the question of whether it is constrained to this and whether a base URI must be explicit except for an immediate child.

With the phrase "if one exists" in these rules (while I know its intention), I think this also raises the question about whether this might refer to whether an explicit definition exists.

I know that the answer can be derived, but I think some extra note or qualification could help make it more explicit.

Brett

Brett
Reply | Threaded
Open this post in threaded view
|

Re: xml:base

Richard Tobin-2

The XML Core WG believes that the specification is clear and
unambiguous, but we are happy to add a note after the bullet
points in 4.2 confirming that base URIs can be inherited:

   Note: It follows that the base URI specified by an xml:base
   attribute is inherited by descendant elements within the same
   entity until another element with an xml:base attribute is
   encountered.

-- Richard



 

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.