The node-name() function

Smartsite 7.4 - ...

The node-name() XPath 2.0 function returns the name of a node (as an qualified name).

XML CopyCode image Copy Code
string fn:node-name(arg1)

Parameters:

  • arg1: a node reference. 

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:meta="http://smartsite.nl/namespaces/metadocument/2.0"
 xmlns:fn="http://www.w3.org/2005/xpath-functions">
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
     <data xmlns="http://smartsite.nl/namespaces/metadocument/2.0">
       <entry>
         <code>abc</code>
         <strings xmlns="">
           <string index="1">a</string>
           <meta:string index="2">b</meta:string>
         </strings>
       </entry>
     </data>
   </xf:instance>
  </xf:model>
 </head>
 <body>
   <xf:group ref="meta:entry" appearance="full" class="node-name">
     <xf:label />
     <xf:output value="fn:node-name(meta:code)" />
     <xf:output value="fn:node-name(strings/child::node()[local-name()='string'][1])" />
     <xf:output value="fn:node-name(strings/child::node()[local-name()='string'][2])" />
     <xf:output value="fn:node-name(strings/meta:string/@index)" />
   </xf:group>
 </body>
</html>

The result will be:

code
string
meta:string
index
 
Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).