01: package net.sf.saxon.functions;
02:
03: import net.sf.saxon.expr.XPathContext;
04: import net.sf.saxon.om.Item;
05: import net.sf.saxon.trans.XPathException;
06: import net.sf.saxon.trans.DynamicError;
07: import net.sf.saxon.value.*;
08:
09: /**
10: * This class supports the dateTime($date, $time) function
11: */
12:
13: public class DateTimeConstructor extends SystemFunction {
14:
15: /**
16: * Evaluate the expression
17: */
18:
19: public Item evaluateItem(XPathContext context)
20: throws XPathException {
21: DateValue arg0 = (DateValue) argument[0].evaluateItem(context);
22: TimeValue arg1 = (TimeValue) argument[1].evaluateItem(context);
23: try {
24: return new DateTimeValue(arg0, arg1);
25: } catch (DynamicError e) {
26: if (e.getLocator() == null) {
27: e.setLocator(this );
28: }
29: if (e.getXPathContext() == null) {
30: e.setXPathContext(context);
31: }
32: throw e;
33: }
34: }
35:
36: }
37:
38: //
39: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
40: // you may not use this file except in compliance with the License. You may obtain a copy of the
41: // License at http://www.mozilla.org/MPL/
42: //
43: // Software distributed under the License is distributed on an "AS IS" basis,
44: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
45: // See the License for the specific language governing rights and limitations under the License.
46: //
47: // The Original Code is: all this file.
48: //
49: // The Initial Developer of the Original Code is Michael H. Kay
50: //
51: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
52: //
53: // Contributor(s): none.
54: //
|