The local-name() function
Smartsite 7.4 - ...
The local-name() XPath 2.0 function returns the local part of the name of a node.
| XML |
|
|---|---|
string fn:local-name(arg1) |
|
Parameters:
- arg1: a node reference.
Example
| XML |
|
|---|---|
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:exf="http://smartsite.nl/namespaces/xforms/1.0"
xmlns:meta="http://smartsite.nl/namespaces/metadocument/2.0"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cust="http://example.org">
<head>
<title>XForms Document</title>
<xf:model>
<xf:instance>
<data xmlns="http://smartsite.nl/namespaces/metadocument/2.0">
<entry xmlns:cust="http://example.org">
<code>abc</code>
<cust:strings>
<cust:string index="1">a</cust:string>
<cust:string index="2" cust:prefattr="prefixed attribute">c</cust:string>
</cust:strings>
</entry>
</data>
</xf:instance>
</xf:model>
</head>
<body>
<xf:group ref="meta:entry">
<xf:label />
<xf:output value="fn:local-name(meta:code)" />
<xf:output value="fn:local-name(//cust:strings)" />
<xf:output value="fn:local-name(//cust:string[1]/@index)" />
<xf:output value="fn:local-name(//cust:string[2]/@cust:prefattr)" />
</xf:group>
</body>
</html>
|
|
The result will be:
code
strings
index
prefatrr
strings
index
prefatrr
Namespace
This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).