Returns the namespace URI of one of the in-scope namespaces for $element
,
identified by its namespace prefix.
fn:namespace-uri-for-prefix
( $prefix
as xs:string?
,$element
as element()
xs:anyURI?
If $element
has an in-scope namespace whose namespace prefix is equal to
$prefix
, the function returns the namespace URI of that namespace.
If $element
has no in-scope namespace whose namespace prefix is equal to
$prefix
, the function returns the empty sequence.
If $prefix
is the zero-length string or the empty sequence, then if
$element
has a default namespace (that is, a namespace node with no
name), the function returns the namespace URI of the default namespace. If
$element
has no default namespace, the function returns the empty
sequence.
Prefixes are equal only if their Unicode codepoints match exactly.
let $e :=
The expression fn:namespace-uri-for-prefix("z", $e)
returns "http://example.org/two"
.
The expression fn:namespace-uri-for-prefix("", $e)
returns "http://example.org/one"
.
The expression fn:namespace-uri-for-prefix((), $e)
returns "http://example.org/one"
.
The expression fn:namespace-uri-for-prefix("xml", $e)
returns "http://www.w3.org/XML/1998/namespace"
.
The expression fn:namespace-uri-for-prefix("xml", $e)
returns "http://www.w3.org/XML/1998/namespace"
.