- From: Ignacio Hernandez-Ros <ihr@xbrl.org>
- Date: Tue, 21 Feb 2006 10:47:49 +0100
- To: <public-qt-comments@w3.org>
- Message-ID: <000301c636cb$e3b8adf0$d40a0a0a@LUISA>
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. The use case is better explained in the following paragraph. Doing operations with XBRL concepts require also operate with the units, consequently there are XQuery formulas to create and operate with units. The output of those functions is an XML piece that contains QNames and those QNames have namespaces that must be created on the fly. Here is an example in pseudo XBRL (not valid XBRL except for the important parts) to simplify the problem: <xbrl xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns="http://www.xbrl.org/2003/instance"> <unit id="EURO"> <measure>iso4217:EUR</measure> </unit> <unit id="SHARES"> <measure>shares</measure> </unit> <taxonomyX:numberOfShares unitRef="SHARES">1000</> <taxonomyX:socialCapital unitRef="EURO">1000</> </xbrl> If a formula wanted to create a Euros per Share calculation and place the result in a new XBRL document, it must operate the facts and the units as well. The syntax for the unit element already covers this possibility. The resulting unit is: <unit id="userdefinedEUROSPERSHARE"> <divide> <numerator> <measure xmlns:iso4217="http://www.xbrl.org/2003/iso4217">iso4217:EUR</measure> </numerator> <denominator> <measure>shares</measure> </denominator> </divide> </unit> Note that I've explicitly copied the xmlns:iso4217 namespace declaration in the measure element where it is needed. In the XBRL instance Schema http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd , the type of the measure element is QName. While developing an XBRL library in XQuery 1.0 the following function was described. xfi:create-unit($numerator as xs:QName+, $denominator as xs:QName*, $id as xs:string) as element(xbrli:unit) The function returns a schema validated xbrli:unit similar to the one for "userdefinedEUROSPERSHARE" but this function (valid for any kind of unit) cannot be created in XQuery 1.0. The problem is that it is not possible to create measure elements including the namespace declaration of the QName content. Actually I've a solution for this problem that requires knowing in advance all possible namespaces the function is able to work with and create the measure element with constructions like this: if (namespace-uri-from-QName($measure) = xs:anyURI("http://www.xbrl.org/2003/iso4217")) then validate strict { <xbrli:measure xmlns:iso4217="http://www.xbrl.org/2003/iso4217">{ concat("iso4217:",local-name-from-QName($measure)) }</xbrli:measure> } else . Please annotate this as a note for the current spec or a requirement for the next release of the XQuery specification. Regards, IHR Ignacio Hernandez-Ros XBRL International Inc. - Technology Development ihr@xbrl.org Cell: +34 609027754
Received on Tuesday, 21 February 2006 11:19:20 UTC