This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Bug 5703, reported against XQTS and closed last year, suggested that the correct response for namespace-uri-for-prefix('', $in-xml) was a zero-length string, where there is no default namespace in the in-scope namespaces of $in-xml. In 11.2.5 fn:namespace-uri-for-prefix we say, "If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it returns the namespace URI of that namespace. If $prefix is the zero-length string or the empty sequence, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence." Where there is no default namespace, one could imagine returning either an empty sequence or a zero-length string as the result. Michael Kay has suggested that specifying the result as the zero-length string would be consistent with namespace-uri and namespace-uri-from-QName.
I agree this should be clarified. I suggest: * If $element has an in-scope namespace whose namespace prefix is equal to $prefix, the function returns the namespace URI of that namespace. * If $prefix is the zero-length string or the empty sequence, the function returns the namespace URI of the default namespace for $element if there is one, or the zero-length string otherwise * In all other cases, the function returns the empty sequence.
Investigation shows that different implementors have indeed interpreted this differently: some return "", some (). In favour of "": * this means that a return result of () always means the prefix is not available for use * the prefix "" in this situation means "no namespace", and in other functions such as namespace-uri(), or namespace-uri-from-QName(), "no namespace" is denoted by "". * This intepretation means that a redundant "xmlns=''" declaration has no effect, which is desirable, since it has no meaning. * this is what the spec currently says: "If $element has an in-scope namespace whose namespace prefix is equal to $prefix..." - not applicable, it doesn't. "If $prefix is the zero-length string ..., it returns the namespace URI of the default (unnamed) namespace. - the condition is satisfied, so the only question is "what is the namespace URI of the default (unnamed) namespace?" In other methods, it is always "". "Otherwise, it returns the empty sequence." - not applicable, we don't get this far. Michael Kay
A decision on this was recorded in the minutes on 28 April: http://lists.w3.org/Archives/Member/w3c-xsl-query/2009Apr/0069.html (member-only link) The decision was to return a zero-length string. An erratum will be drafted against the "second edition" spec.
I am marking this RESOLVED FIXED because WG has made the decision. (The editor will implement the solution on his own timetable.) If you're satisfied with this resolution, please mark the bug CLOSED.