- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Fri, 16 Jan 2004 23:45:11 +0100
- To: <public-qt-comments@w3.org>, "Per Bothner" <per@bothner.com>
Per, On 2003-11-24, in message http://lists.w3.org/Archives/Public/public-qt-comments/2003Nov/0292.html you commented on the confused semantics of computed namespace constructors. I am responding to this comment on behalf of the XQuery Working group. Firstly, thank you for the comment. In fact, the working group was already aware that there were problems in this area, and spent some time at its November meeting addressing the issue. Unfortunately this was too late to affect the 12 November draft. There was some debate as to whether the semantics should be purely dynamic or purely static; as you pointed out it was clearly unsatisfactory to have a mixture of the two. The WG decided on a static interpretation. The revised text agreed by the WG reads as follows. Computed namespace constructors as a free-standing expression have disappeared, and the syntax has merged into the computed element constructor, thus: [102] CompElemConstructor ::= (("element" QName "{") | ("element" "{" Expr "}" "{")) CompElemBody? "}" [103] CompElemBody ::= (CompElemNamespace | ExprSingle) ("," (CompElemNamespace | ExprSingle))* [104] CompElemNamespace ::= "namespace" NCName? "{" StringLiteral "}" The semantics are: In a computed element constructor, the name expression is followed by the body, which consists of zero or more local namespace declarations (CompElemNamespace) followed an optional content expression (ExprSingle). If more than one content expression is present, or if a local namespace declaration follows the content expression, a static error is raised.[err:XQ0042] A local namespace declaration contains an optional namespace prefix and a namespace URI expressed as a string literal. The namespace prefix, if present, must be distinct from all other namespace prefixes declared within the same computed element constructor.[err:XQ0043] If the namespace prefix is present, it is bound to the given namespace URI and added to the in-scope namespaces for the constructed element. If no namespace prefix is present, the given namespace URI specifies the default element/type namespace within the scope of the constructed element. The use of local namespace declarations in a computed element constructor is illustrated by the following example, in which the default element/type namespace is set to http://example.org/ns1 and the prefix space2 is bound to the namespace URI http://example.org/ns2: element {$computed-name} { namespace {"http://example.org/ns1"}, namespace space2 {"http://example.org/ns2"}, $content } ================ Namespaces declared in a computed element constructor are treated the same way as namespaces in a direct element constructor: they become available in the static context, and they are copied when elements are written to the result tree. Note that by choosing a static interpretation, the WG made a conscious decision not to provide any capability in XQuery 1.0 for dynamic creation of namespaces in the result tree (i.e. namespaces whose URIs are not known statically at the time the query is written). I would be grateful if you could confirm that the revised text resolves the issue you raised in your comment. Regards, Michael Kay for the XQuery working group discharging action A-164-01
Received on Friday, 16 January 2004 17:45:39 UTC