[Bug 12645] New: Incorrect example for computed namespace constructors

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

           Summary: Incorrect example for computed namespace constructors
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.0
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


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).

-- 
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 Wednesday, 11 May 2011 08:44:54 UTC