This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1283 - [XSLT/XQuery] Needless difference between XSLT and XQuery in base URI handling
Summary: [XSLT/XQuery] Needless difference between XSLT and XQuery in base URI handling
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-03 09:38 UTC by Michael Kay
Modified: 2005-06-10 23:46 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-05-03 09:38:02 UTC
This is a coordination issue between XSLT and XQuery.

In XSLT, when an element is copied in the course of constructing its parent
element, the base URI of the child element is changed to be the same as its new
parent, unless it has an xml:base attribute that overrides this.

In XQuery, in the same circumstances, the base URI of the child element remains
unchanged.

I don't think there is any difference in requirements that justifies this
difference in behavior, so we should try to align the specs. I know that both
working groups consciously decided to write the specs the way they are - and
there are arguments for going either way - but I think we should have another
attempt to bring them into line.

The argument in favour of not changing the base URI is that this will tend to
preserve the meaning of any relative URIs in the content being copied.

The argument in favour of changing it is that a tree in which the base URI
changes arbitrarily from one element to another, without any visible signal such
as an xml:base attribute or an external entity reference, is very difficult for
users to understand. There are many other operations (such as serialization)
that cause the base URI to change, and if users want to protect themselves they
should either absolutize the URIs, or use xml:base. In fact there are many cases
where relative URIs are used quite deliberately because the base URI may vary.

There are arguments both ways, but there is no good reason for the two specs to
be inconsistent.
Comment 1 Michael Rys 2005-05-03 13:33:32 UTC
I think another solution would be to get rid of giving xml:base any special 
meaning and just treat them as user-provided attributes.

95% of the users do not understand xml:base anyway.
Comment 2 Michael Kay 2005-05-03 13:45:26 UTC
If we ignored xml:base we would soon end up in a position where 100% of users
didn't understand it. Perhaps you'd consider that an improvement.
Comment 3 Don Chamberlin 2005-06-10 23:46:24 UTC
Mike,
On May 18, 2005, the Query Working Group discussed your comment and agreed to 
make the following change to XQuery Section 3.7.1.3, Rule 1-e-ii-E: 
"When an element or processing instruction node is copied, its base-uri
property is set to be the same as that of its new parent,
with the following exception: if a copied element node has an xml:base 
attribute, its base-uri property is set to
the value of that attribute, resolved (if it is relative) against
the base-uri property of the new parent node.
All other properties of the copied nodes are preserved."

Since you were a participant in this discussion, I will mark this comment as 
Fixed and Closed.