Name
namespace-uri() Function — Returns the namespace URI of the first node in the argument node-set.
Synopsis
stringnamespace-uri(node-set?)
Inputs
A node-set. If the node-set is omitted, the namespace-uri() function creates a node-set that has the context node as its only member.
Output
The namespace URI of the first node in the argument node-set. If the argument node-set is empty, the first node has no namespace URI, or the first node has a namespace URI that is null, an empty string is returned. Be aware that the namespace-uri() function returns an empty string for all nodes other than element and attribute nodes.
Defined in
XPath section 4.1, Node Set Functions.
Example
Here is a stylesheet that uses the document() function to examine its own nodes and then invoke the namespace-uri() against each of them:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:months="Lookup table for month names"> <months:name sequence="01">January</months:name> <months:name sequence="02">February</months:name> <months:name sequence="03">March</months:name> <months:name sequence="04">April</months:name> <months:name sequence="05">May</months:name> <months:name sequence="06">June</months:name> <months:name sequence="07">July</months:name> <months:name sequence="08">August</months:name> <months:name sequence="09">September</months:name> <months:name sequence="10">October</months:name> <months:name sequence="11">November</months:name> <months:name ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access