public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
localTypeCheck(visitor, contextItemType);
if (select != null) {
final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy();
select = visitor.typeCheck(select, contextItemType);
if (!select.getItemType(th).isAtomicType()) {
select = new Atomizer(select, visitor.getConfiguration()).simplify(visitor);
}
if (!th.isSubType(select.getItemType(th), BuiltInAtomicType.STRING)) {
select = new AtomicSequenceConverter(select, BuiltInAtomicType.STRING);
}
adoptChildExpression(select);
}
return this;