01: package net.sf.saxon.functions;
02:
03: import net.sf.saxon.expr.Expression;
04: import net.sf.saxon.expr.StaticContext;
05: import net.sf.saxon.trans.XPathException;
06: import net.sf.saxon.value.AnyURIValue;
07: import net.sf.saxon.value.EmptySequence;
08:
09: /**
10: * This class supports the static-base-uri() function in XPath 2.0
11: * (added by the working groups on 24 August 2004)
12: */
13:
14: public class StaticBaseURI extends CompileTimeFunction {
15:
16: /**
17: * Compile time evaluation
18: */
19:
20: public Expression preEvaluate(StaticContext env)
21: throws XPathException {
22: String baseURI = env.getBaseURI();
23: if (baseURI == null) {
24: return EmptySequence.getInstance();
25: }
26: return new AnyURIValue(baseURI);
27: }
28:
29: }
30:
31: //
32: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
33: // you may not use this file except in compliance with the License. You may obtain a copy of the
34: // License at http://www.mozilla.org/MPL/
35: //
36: // Software distributed under the License is distributed on an "AS IS" basis,
37: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
38: // See the License for the specific language governing rights and limitations under the License.
39: //
40: // The Original Code is: all this file.
41: //
42: // The Initial Developer of the Original Code is Michael H. Kay.
43: //
44: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
45: //
46: // Contributor(s): none.
47: //
|