Re: Requirement: Dynamically add namespaces to new created elements.

We should probably move to the xquery-talk list as this list is just
for spec comments, and I'm not on the WG in any case

But

> The simplest example that does not work is this one:
> 
> declare namespace xbrli = "http://www.xbrl.org/instance";
> 
> declare function local:f($q as xs:QName) as element()
> {
> 	element xbrli:measure { $q }
> }

but that can be made to work using the technique I showed:


declare namespace xbrli = "http://www.xbrl.org/instance";

declare function local:f($q as xs:QName) as element()
{
element {$q} {
	element xbrli:measure { $q }
}/*};

local:f(QName("http://example.org","x"))


this generates

<xbrli:measure xmlns:xbrli="http://www.xbrl.org/instance" xmlns="http://example.org">x</xbrli:measure>


> The only solution to deal with this situation 
That's a natural solution (and the analogue of XSLT2's xsl:namespace
instruction) But the above is _a_ solution (and the analogue of the
well known techniques used in XSLT1 to get round the lack of an
xsl:namespace instruction in XSLT1)..

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Received on Tuesday, 21 February 2006 14:46:15 UTC