[Bug 8219] New: [XSLT] Shallow copy and xml:base

http://www.w3.org/Bugs/Public/show_bug.cgi?id=8219

           Summary: [XSLT] Shallow copy and xml:base
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
               URL: http://www.w3.org/TR/xslt20/#shallow-copy
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


The following paragraph towards the end of the Shallow copy section

"The base URI of a node is copied, except in the case of an element node having
an xml:base  attribute, in which case the base URI of the new node is taken as
the value of the xml:base  attribute, resolved if it is relative against the
base URI of the xsl:copy  instruction. If the copied node is subsequently
attached as a child to a new element or document node, the final copy of the
node inherits its base URI from its parent node, unless this is overridden
using an xml:base attribute."

is ambiguous in that it is unclear whether

"the case of an element node having an xml:base attribute"

refers to:

(1) an xml:base attribute of the element being copied, OR
(2) an xml:base attribute in the content sequence contained in the xsl:copy.


Consider the source document:

<?xml version="1.0"?>
<doc xml:base="http://source.base.uri">
  <inner xml:base="AAA/" />
</doc>

and the transformation:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

  <xsl:template match="/doc/inner">
     <xsl:variable name="target" as="element()">
       <xsl:copy xml:base="http://copy.base.uri">
         <xsl:attribute name="xml:base">BBB/</xsl:attribute>
       </xsl:copy>
     </xsl:variable>
     <out>
       <xsl:value-of select="base-uri($target)" />
     </out>
  </xsl:template>

</xsl:stylesheet>

Interpretation (1):

The xml:base attribute is "AAA/"
Resolving against the base URI of xsl:copy gives "http://copy.base.uri/AAA/".
The result is therefore:

<out>http://copy.base.uri/AAA/</out>


Interpretation (2)

The xml:base attribute is "BBB/"
Resolving against the base URI of xsl:copy gives "http://copy.base.uri/BBB/".

The result is therefore:

<out>http://copy.base.uri/BBB/</out>


I suspect that interpretation 2 is correct, however, when I've tried this with
an XSLT 2.0 implementation, the result was:

<out>http://source.base.uriAAA/BBB</out>


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 6 November 2009 17:33:22 UTC