AtomicValue min = null;
while (iter.hasNext()) {
final Item item = iter.nextItem();
if (item instanceof QNameValue)
{throw new XPathException(this, ErrorCodes.FORG0006, "Cannot compare " + Type.getTypeName(item.getType()), arg);}
AtomicValue value = item.atomize();
//Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
if (Type.subTypeOf(value.getType(), Type.DURATION)) {
value = ((DurationValue)value).wrap();
if (value.getType() == Type.YEAR_MONTH_DURATION) {