[Bug 4151] XQTY0086 description is too limited

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

           Summary: XQTY0086 description is too limited
           Product: XPath / XQuery / XSLT
           Version: Proposed Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


One of my users is struggling with the problem of how to use XQuery to make an
amended copy of elements with namespace-sensitive content. It really isn't easy
(in fact, I don't think it's possible in general); but that's a subject for
vendor extensions now and for XQuery 1.1 in due course.

Meanwhile, there's a situation that the spec doesn't seem to address. Consider
the construct

element { node-name($t) } {
    $e/@*, $e/*
  }

where construction mode is preserve, and one of the attributes is typed as a
QName. I think this should give error XQTY0086. But the current description of
XQTE0086 is too narrow. It says:

<quote>
It is a type error [err:XQTY0086] in this case [where copy-namespaces mode
specifies no-preserve] if the typed value of the copied element or of any of
its attributes is namespace-sensitive.
</quote>

But in this example the namespace-sensitive attribute does not belong to a
copied element, and that's a problem regardless of the copy-namespaces mode.

The equivalent XSLT error condition is wider:

<quote>
[ERR XTTE0950] It is a type error to use the xsl:copy or xsl:copy-of
instruction to copy a node that has namespace-sensitive content if the
copy-namespaces attribute has the value no and its explicit or implicit
validation attribute has the value preserve. It is also a type error if either
of these instructions (with validation="preserve") is used to copy an attribute
having namespace-sensitive content, unless the parent element is also copied. A
node has namespace-sensitive content if its typed value contains an item of
type xs:QName or xs:NOTATION or a type derived therefrom. The reason this is an
error is because the validity of the content depends on the namespace context
being preserved.
</quote>

I think this needs a new clause, perhaps between D and E, along the lines:

<proposed>
D2 If construction mode is preserve, and the value of an enclosed expression
includes an attribute node whose typed value is namespace-sensitive, then error
[err:XQTY0086] is raised.
</proposed>

Received on Friday, 5 January 2007 21:15:20 UTC