W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2006

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

From: David Carlisle <davidc@nag.co.uk>
Date: Tue, 21 Feb 2006 14:38:21 GMT
Message-Id: <200602211438.OAA14782@penguin.nag.co.uk>
To: ihr@xbrl.org
CC: public-qt-comments@w3.org


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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:10 UTC