- From: David Carlisle <davidc@nag.co.uk>
- Date: Tue, 21 Feb 2006 12:10:17 GMT
- To: ihr@xbrl.org
- CC: public-qt-comments@w3.org
Looking at the current XQuery spec 1.0 I realized that it is not possible to dynamically create a namespace declaration to an element when you are dynamically creating the element or when using a QName as element content. If I understand your example can't you just copy the measure element from your input (the namespace declaration will be added by the serialiser). If you do need to generate an in-scope namespace from scratch from a namespace that is neither in the source file nor query, it's true that XQuery doesn't have an analogue of XSLT's xsl:namespace instruction but it is still possible. Consider for example the following function which generates an element with specified name and a namespace declaration with a specifed prefix and URI. It's called with three string literals below and generates <foobar xmlns:x="http://example.org"/> but of course the three parameters could be any string-valued expressions. David declare function local:f ($elem as xs:string,$prefix as xs:string,$ns as xs:string) as element() { element {QName($ns,concat($prefix,":wibble"))}{ element {$elem}{} }/*}; local:f("foobar","x","http://example.org") ________________________________________________________________________ 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 12:18:30 UTC