Discrimination of electronic recoils from nuclear recoils in two-phase xenon time projection chambers