As described in the file http://www.w3.org/TR/2003/WD-xpath-functions-20031112/#func-get-namespace-uri-from-QName 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("http://www.example.com/example", "person")) returns the namespace URI corresponding to http://www.example.com/example.
 
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 http://www.w3.org/TR/2003/WD-xquery-20031112/#id-computed-pis 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')) = ''">
        ...
    </xsl:if>
but it doesn´t.