Re: namespace nodes in element content

Kay, Michael wrote:

> XQuery does not provide the namespace axis, and does not provide any 
> other construct that allows you to get your hands on a namespace node. 
> Therefore, the sequence that provides the content for a new element can 
> never contain namespace nodes, except in the very limited and controlled 
> way allowed by computed namespace constructors.

That wasn't the issue I've asked about.  I was asking why not allow:

let $n := namespace metric {"http://example.org/metric-system"}
<altitude>{
   $ns,
   attribute {"metric:unit"} {"meter},
   10000
}</altitude>

However, I now see the following sentence which I overlooked before:

   The immediately enclosing expression of the computed namespace
   constructor must be a computed element constructor; otherwise a
   static error is raised.

I missed this, as I would have expected this constraint to be
expressed in the grammar.  That could express it clearer, and
also add the cnstraint that the namespace nodes must come first:

CompElemConstructor  	   ::=
      	(("element" QName "{") | ("element" "{" Expr "}" "{"))
         ((CompNSConstructor ("," CompNSConstructor)* | ExprSingle)
         (", " ExprSingle)*)? "}"
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

Received on Tuesday, 26 August 2003 11:15:14 UTC