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 12645 - Incorrect example for computed namespace constructors
Summary: Incorrect example for computed namespace constructors
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 08:44 UTC by Michael Kay
Modified: 2011-06-10 22:22 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2011-05-11 08:44:48 UTC
In section 3.8.3 this example is incorrect:

<form>
 {
    namespace a {"http://a.example.com" },
    attribute { xs:QName("a:id") } { "a-12-XE-45" },
    element { xs:QName("a:field")} { "Sample data" }
 }
</form>

The expression xs:QName("a:id") requires prefix "a" to be present in the static context, which it isn't; it's only present in the in-scope namespaces of the new form element.

It's also a poor choice of example because no computed namespace constructor is needed here; the namespace will be created automatically by the fixup process. A better example would be

<age xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> {
  namespace xs {"http://www.w3.org/2001/XMLSchema"},
  attribute xsi:type {"xs:integer"},
  23
}</age>

This illustrates the distinction between the xsi namespace which is created automatically because it's used in an attribute name, and the xs namespace which needs to be created by hand because it's used only in attribute content. (Though of course, it could be created statically if it's known statically).
Comment 1 Jim Melton 2011-06-10 22:21:44 UTC
The XML Query WG agreed during its meeting on 2011-06-07 (documented in members-only email archived at http://lists.w3.org/Archives/Member/w3c-xsl-query/2011Jun/0010.html) with the problem and with the proposed solution.  Based on this decision, we are marking the bug as RESOLVED/FIXED.  Because you were present when the decision was made and are in agreement with the resolution, I am also marking the bug CLOSED.