Description
The functx:namespaces-in-use function returns a list of all the namespaces used in element and attribute names in the scope of $root . It does not include namespaces that are declared but not used, or ones that are used in names that are the content (as opposed to the names) of elements or attributes.
Arguments and Return TypeName | Type | Description |
$root |
node()? |
the root node to start from |
return value |
xs:anyURI* |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:namespaces-in-use" as="xs:anyURI*"
xmlns:functx="http://www.functx.com">
<xsl:param name="root" as="node()?"/>
<xsl:sequence select="
distinct-values(
$root/descendant-or-self::*/(.|@*)/namespace-uri(.))
"/>
</xsl:function>
|
Examples<xsl:variable name="in-xml" as="item()*"> | | <authors xmlns="abc" xmlns:d="def">
<author xmlns="ghi">
<fName xmlns:x="xyz" x:attr="123">Kate</fName>
<lName>Jones</lName>
</author>
</authors> |
| </xsl:variable> |
XPath Example | Results | Explanation |
---|
functx:namespaces-in-use($in-xml) |
(abc, ghi, xyz) |
def is not listed because it is not used in any names |
See AlsoHistory |
Recommended Reading:
|