home contribute faq download

FunctX XQuery Functions

fn:in-scope-prefixes

The prefixes that are in scope for an element

Google
Webxqueryfunctions.com

Description

The fn:in-scope-prefixes function returns a sequence of prefixes (as strings) that are used in the in-scope namespaces for the $element element. The results include a zero-length string if there is a default namespace declaration. It also always includes the xml prefix, which is built into the XML recommendation.

Note that the function uses in-scope namespaces, as opposed to statically known namespaces. For example, it does not necessarily include all the prefixes declared in the prolog, if they are not used by $element or one of its ancestors. .

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameType
$element element()
return value xs:string*

Examples

let $in-xml :=
<in-xml xmlns="http://datypic.com/prod"
          xmlns:prod2="http://datypic.com/prod2">
            xyz</in-xml>
return
XQuery ExampleResults
in-scope-prefixes($in-xml)
('', 'prod2', 'xml')

See Also

functx:namespaces-in-useA list of namespaces used in element/attribute names in an XML fragment
fn:namespace-uri-for-prefixThe namespace associated with a prefix, in the scope of an element

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XQuery Services

Recommended Reading:

XQuery