| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.XPathContext; |
| 11 |
import net.sf.saxon.om.Item; |
| 12 |
import net.sf.saxon.om.NodeInfo; |
| 13 |
import net.sf.saxon.trans.XPathException; |
| 14 |
import net.sf.saxon.type.BuiltInAtomicType; |
| 15 |
import net.sf.saxon.value.AtomicValue; |
| 16 |
import net.sf.saxon.value.QNameValue; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public class NodeName_1 extends ScalarSystemFunction { |
| 23 |
|
| 24 |
@Override |
| 25 |
public AtomicValue evaluate(Item item, XPathContext context) throws XPathException { |
| 26 |
return nodeName((NodeInfo) item); |
| 27 |
} |
| 28 |
|
| 29 |
public static QNameValue nodeName(NodeInfo node) { |
| 30 |
if (node.getLocalPart().isEmpty()) { |
| 31 |
return null; |
| 32 |
} |
| 33 |
return new QNameValue(node.getPrefix(), node.getURI(), node.getLocalPart(), BuiltInAtomicType.QNAME); |
| 34 |
} |
| 35 |
|
| 36 |
public String getCompilerName() { |
| 37 |
return "NodeNameFnCompiler"; |
| 38 |
} |
| 39 |
|
| 40 |
} |
| 41 |
|