/** * Get the dateTime value representing the nominal date/time of this transformation run. Two calls * within the same query or transformation will always return the same answer. * * @param context the XPath dynamic context. May be null, in which case the current date and time * are taken directly from the system clock * @return the current xs:dateTime */ public static DateTimeValue getCurrentDateTime(XPathContext context) { Controller c; if (context == null || (c = context.getController()) == null) { // non-XSLT/XQuery environment // We also take this path when evaluating compile-time expressions that require an implicit // timezone. return new DateTimeValue(new GregorianCalendar(), true); } else { return c.getCurrentDateTime(); } }