private AbstractExpression exprFor (InstanceOfExpression expr) { ItemType type = expr.getRequiredItemType(); String typeExpr; if (type.isPlainType()) { typeExpr = type.toString(); } else if (type instanceof NodeTest) { lux.xpath.NodeTest nodeTest = nodeTestFor((NodeTest)type); typeExpr = nodeTest.toString(); } else { throw new LuxException ("Unsupported node test in instance-of expression: " + expr.toString()); } return new InstanceOf(typeExpr, exprFor (expr.getBaseExpression())); }