home contribute faq download

FunctX XSLT Functions

fn:namespace-uri

The namespace URI of a node

Google
Webdatypic.com

Description

The fn:namespace-uri function returns the namespace part of the element or attribute name. This is the namespace that is mapped to its prefix, or the default namespace if it is unprefixed. If the element or attribute name is not in a namespace, a zero-length string is returned.

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
$arg node()?
return value xs:anyURI

Examples

<xsl:stylesheet xmlns:pre="http://datypic.com/pre"
                xmlns:unpre="http://datypic.com/unpre">...
<xsl:variable name="in-xml" as="item()*">
<noNamespace>
     <pre:prefixed xmlns="http://datypic.com/unpre"
              xmlns:pre="http://datypic.com/pre">
       <unprefixed pre:prefAttr="a" noNSAttr="b">123</unprefixed>
     </pre:prefixed>
   </noNamespace>
</xsl:variable>
XPath ExampleResultsExplanation
namespace-uri($in-xml)
zero-length xs:anyURI value the noNamespace element itself
namespace-uri($in-xml//pre:prefixed)
http://datypic.com/pre
namespace-uri($in-xml//unpre:unprefixed)
http://datypic.com/unpre
namespace-uri($in-xml//@pre:prefAttr)
http://datypic.com/pre
namespace-uri($in-xml//@noNSAttr)
zero-length xs:anyURI value

See Also

fn:node-nameThe qualified name of a node, as a QName
fn:namespace-uri-for-prefixThe namespace associated with a prefix, in the scope of an element
fn:namespace-uri-from-QNameThe namespace part of a QName
functx:namespaces-in-useA list of namespaces used in element/attribute names in an XML fragment

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 XSLT Services

Recommended Reading:

XQuery