| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.Callable; |
| 11 |
import net.sf.saxon.expr.XPathContext; |
| 12 |
import net.sf.saxon.om.NodeInfo; |
| 13 |
import net.sf.saxon.om.Sequence; |
| 14 |
import net.sf.saxon.om.ZeroOrOne; |
| 15 |
import net.sf.saxon.trans.XPathException; |
| 16 |
import net.sf.saxon.value.AnyURIValue; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public class BaseUri_1 extends SystemFunction implements Callable { |
| 23 |
|
| 24 |
public ZeroOrOne<AnyURIValue> call(XPathContext context, Sequence[] arguments) throws XPathException { |
| 25 |
NodeInfo node = (NodeInfo)arguments[0].head(); |
| 26 |
if (node == null) { |
| 27 |
return ZeroOrOne.empty(); |
| 28 |
} |
| 29 |
String s = node.getBaseURI(); |
| 30 |
if (s == null) { |
| 31 |
return ZeroOrOne.empty(); |
| 32 |
} |
| 33 |
return new ZeroOrOne<>(new AnyURIValue(s)); |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
public String getCompilerName() { |
| 38 |
return "BaseURICompiler"; |
| 39 |
} |
| 40 |
|
| 41 |
} |
| 42 |
|