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 3417 - [XSLT] Base URI of a copied element
Summary: [XSLT] Base URI of a copied element
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-30 11:34 UTC by Michael Kay
Modified: 2006-08-16 18:28 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-06-30 11:34:37 UTC
For xsl:copy and xsl:copy-of, the rules say that the base URI property of the element is copied unchanged. 

If the element has an xml:base attribute, I don't feel this rule is right.

Firstly, for xsl:copy, the new element may have an xml:base attribute that wasn't present on the original element, and it seems wrong to ignore this.

Secondly, for both instructions, the element may have a relative xml:base attribute, and it makes sense to "re-resolve" this in the same way as we would do with a newly constructed element. Otherwise it could lead to the element having a base URI that is different from the one that would be obtained by computation. 

Related to this, I think we should clarify that when we make use of the value of xml:base in determining the base URI of a node, we process the attribute as described in the XML Base specification, in particular, we percent-encode special characters.

Specific changes:

(a) for xsl:copy and xsl:copy-of, instead of "The base URI of the node is copied", we should say: "The base URI of the node is copied, except in the case of an element node having an xml:base attribute, in which case the base URI is taken as the value of the xml:base attribute, resolved if it is relative against the base URI of the xsl:copy|xsl:copy-of instruction."

(b) At the end of 5.8, add the rule. "In the case of xml:base this means that the value of the attribute, before being used in any calculation of a base URI, is percent-encoded as described in [XML Base]."
Comment 1 Michael Kay 2006-07-01 20:13:48 UTC
Note that test case baseuri20_044_01 applies here. The stylesheet does:

<xsl:variable name="elemcopy" as="element()">
	<xsl:copy-of select="/doc/str1" />
</xsl:variable>

where the copied element has xml:base="/xml/". The expected results (which are correct according to the spec as currently written) expects the str1 element to have a base URI of http://www.xmlexample.ibm/xml/ - that is, the result of resolving xml:base against the base URI of its original parent node.

(Also note comment 2 in bug #3415 concerning percent-encoding of base URIs.)
Comment 2 Michael Kay 2006-08-03 17:32:27 UTC
As per comment 2 in bug #3415 concerning percent-encoding of base URIs., item (b) of the proposal is withdrawn.
Comment 3 Michael Kay 2006-08-16 18:28:38 UTC
The following change was agreed on 2006-08-03, and has now been applied to the base document:

RESOLVED: accept as specified in item (a) of the description.

     (a) for xsl:copy and xsl:copy-of, instead of "The base URI of the
     node is copied", we should say: "The base URI of the node is
     copied, except in the case of an element node having an xml:base
     attribute, in which case the base URI is taken as the value of the
     xml:base attribute, resolved if it is relative against the base
     URI of the xsl:copy|xsl:copy-of instruction."