* This value is calculated using the algorithm described in
* [Appendix E Adding durations to dateTimes] of [XML Schema Part 2: Datatypes].
* @throws XPathException
*/
public static String add(XPathContext context, final String datetimeIn, final String durationIn) throws XPathException {
ConversionResult cr0 = CalendarValue.makeCalendarValue(datetimeIn);
if (cr0 instanceof ValidationFailure) {
return "";
}
CalendarValue cv0 = (CalendarValue)cr0;
if (specificity(cv0) < 0) {
return "";
}
DateTimeValue v0 = cv0.toDateTime();
ConversionResult cr1 = DurationValue.makeDuration(durationIn);
if (cr1 instanceof ValidationFailure) {
return "";
}
DurationValue v1 = (DurationValue)cr1;
YearMonthDurationValue v1m =