Debian Codegraph @

net/sf/saxon/functions/StaticBaseUri.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.functions;
9
10 import net.sf.saxon.expr.*;
11 import net.sf.saxon.om.Sequence;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.value.AnyURIValue;
14
15 /**
16 * Implement the XPath function static-base-uri()
17 */
18 public class StaticBaseUri extends SystemFunction {
19
20 @Override
21 public AnyURIValue call(XPathContext context, Sequence[] args) throws XPathException {
22 return new AnyURIValue(getRetainedStaticContext().getStaticBaseUriString());
23 }
24
25 @Override
26 public Expression makeFunctionCall(Expression[] arguments) {
27 PackageData pd = getRetainedStaticContext().getPackageData();
28 if (pd.isRelocatable()) {
29 return super.makeFunctionCall(arguments);
30 } else {
31 return Literal.makeLiteral(new AnyURIValue(getRetainedStaticContext().getStaticBaseUriString()));
32 }
33 }
34 }