fn:namespace-uri

Return namespace URI from node.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:namespace-uri(node $node) => anyURI
fn:namespace-uri => string

Description

This function returns the namespace URI of a node if it is qualified by a namespace. If $node is present, it returns its namespace URI, otherwise it returns the namespace URI of the context node. If the respective node is not qualified, the function returns the empty string.

Argument

$node

node

Examples

  • Retrieve namespace URI from previously declared namespace:

    declare namespace dotcom = "http://company.dot.com/namespaces/corporate"
    namespace-uri(<dotcom:bookshelf/>)

    The query returns the namespace URI http://company.dot.com/namespaces/corporate.

  • Retrieve namespace URI from unqualified namespace:

    namespace-uri(<unqualified/>)

    This query returns the empty string.