Most every time one of my XJ´s start stalling, I head for the EGR (early models). The thermo sensor on the block (low left), shuts off the EGR when the motor is cold. When something in the EGR circuit, the EGR itself, the EGR solenoid or the temp. sensor, act up. It will often stall at start up and often when stopping at an intersection or slow speeds around a corner. An easy test is to plug the vacume line to the EGR with a screw and take a test drive. Have also had the rod in the EGR valve stick, the EGR hangs open a touch. You can watch the rod actuate when blipping the throttle on a warm engine. If it seems to be moving freely, it probably isn´t hanging open. If it moves on a cold motor, it´s probably the temp. sender, the EGR solenoid or the wiring. The default on the EGR solenoid is open ( no signal the EGR is operating, perhaps when it shouldn´t be).
I found the temp. sensor cable harness laying on my exhaust manifold. The cable harness for the temp sensor, the 02 sensor and the knock sensor is a continuation of the injector harness that runs down the front of the motor then underneath. Worth a look. Well baked wires can cause problems.
Something to look at, if the idle motor and vacum system seem OK.