in-scope-prefixes function

The fn:in-scope-prefixes function returns a list of prefixes for all in-scope namespaces of an element.

Syntax

Read syntax diagramSkip visual syntax diagramfn:in-scope-prefixes( element)
element
The element for which the prefixes for in-scope namespaces are to be retrieved.

Returned value

The returned value is a sequence of xs:NCName values, which are the prefixes for all in-scope namespaces for element. If a default namespace is in-scope for element, the sequence item for the default namespace prefix is a string of length 0. The namespace "xml" is always included in the in-scope namespaces of an element.

Example

The following query returns a sequences of prefixes (as NCNames) for in-scope namespaces for the element emp.
declare namespace d="http://www.mycompany.com";
let $department := document {
    <comp:dept xmlns:comp="http://www.mycompany.com" id="A07">
        <comp:emp id="31201" />
    </comp:dept> }
return fn:in-scope-prefixes($department/d:dept/d:emp)

The returned value is ("xml", "comp"), not necessarily in that order.