}
if (sequenceType != null) {
//TODO : ignore nodes right now ; they are returned as xs:untypedAtomicType
if (!Type.subTypeOf(sequenceType.getPrimaryType(), Type.NODE)) {
if (!Type.subTypeOf(item.toSequence().getItemType(), sequenceType.getPrimaryType()))
{throw new XPathException(this, ErrorCodes.XPTY0004, "Invalid type for variable $" + varName +
". Expected " +
Type.getTypeName(sequenceType.getPrimaryType()) +
", got " +Type.getTypeName(contextItem.toSequence().getItemType()), inSeq);}
} else if (!Type.subTypeOf(item.getType(), Type.NODE))