Thanks for pointing this out. This was a change between the May 2003 and November 2003 drafts of the specification which I had missed. I have now implemented the change. The test
string(namespace-uri-from-QName(expanded-QName('', 'testlocal'))) eq ''
will work with both the old and the new versions of the spec.
Michael Kay
Saxonica Limited

Was this advice useful? If you benefit from the help given, especially on a commercial project, you can help us to continue to provide this service by making a donation. See 

From: [] On Behalf Of Felix Plohberger
Sent: 18 August 2004 18:03
Subject: [saxon] Does the function fn:namespace-uri-from-QName give wrong results?

As described in the file the function fn:get-namespace-uri-from-QName($arg) returns the empty sequence if $arg is the empty sequence. If $arg is in no namespace, the zero-length string is returned.
There is the example:
fn:get-namespace-uri-from-QName(fn:expanded-QName("", "person")) returns the namespace URI corresponding to
I tried the following:
    <xsl:copy-of select="namespace-uri-from-QName(expanded-QName('', 'testlocal')) = ''"/>
    expanded-QName('', 'testlocal') creates a xs:QName which is in no namespace.
    * As defined above the function fn:get-namespace-uri-from-QName should return the zero-length string for names that are in no namespace (and not the empty sequence).
      Therefore I think the result of the whole copy-of expression should be true.
    * When evaluated using saxon 8.0 an error (cannot compare empty-sequence to xs:string) occurs.
I would like to do the following:
As described in the name expression of a computed processing instruction constructor is processed as follows:
    1. If the name expression returns an expanded QName: If the URI part of the QName is empty, the local part of the QName is used as the name (target) of the processing instruction;                 otherwise a dynamic error is raised.[err:XQ0041]
    2. If the name expression returns a string, that string is cast to a QName, which is then treated as in the previous item. If the cast fails, a dynamic error is raised.[err:XP0021]
    3. If the name expression does not return a QName or a string, a type error is raised.[err:XP0004][err:XP0006]

*How can I check the condition "If the URI part of the QName is empty" of point 1?

I thought it works like this
    <xsl:if test="namespace-uri-from-QName(expanded-QName('', 'testlocal')) = ''">
but it doesn´t.