saxon:in-scope-namespaces

Returns a map from prefixes to namespace URIs giving the in-scope namespace bindings for a given element node.

in-scope-namespaces($node as node()) ➔ map(xs:string, xs:string)

Arguments

 

$node

node()

The input element

Result

map(xs:string, xs:string)

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE. Implemented since Saxon 10.

Notes on the Saxon implementation

Available since Saxon 10. Changed in Saxon 12 to align with the proposed XPath 4.0 function fn:in-scope-namespaces(): the returned map now always includes an entry for the XML namespace.

Details

If the supplied node is not an element, the function returns the empty sequence.

In other cases it returns a map from namespace prefixes to namespace URIs, giving all the in-scope namespace bindings for the element. This is a more efficient way to obtain this information than either the use of the namespace axis, or the XPath 2.0 functions in-scope-prefixes and namespace-uri-for-prefix.

The map includes the default namespace, if there is a binding for the default namespace: the relevant entry in the map will have a key that is the zero-length string. The map always (from Saxon 12) includes the implicit binding of the "xml" namespace to the namespace URI http://www.w3.org/XML/1998/namespace.