if it keeps stalling at idle, its not the battery, altho you may have a duff battery as well. once an engine starts and runs it will draw current direct from the alternator, via the battery leads, so if it stalls back at idle it sounds like you got a fuel starvation problem to me.when was the last time the fuel filter was changed?
Charge the battery properly overnight.If the Jeep has a flat battery it can forget how to idle. In order to re-learn, start her up using the throttle, slowly back off until the rpm drops to below idle speed and let the engine management take over. You may need several attempts for this to happen.
if the battery is literally dead and jump starting from another battery works then with the engine running at a fast idel the alternator will give out what it can for the duff battery. when the jeep then idles around 800rpm the alternator will not be kicking out as much as it would at 1500rpm. So what charge is going into a dead battery is going straight out to the spark plugs then the sensors will read a low voltage and stop the car. stick another battery on it and see what happens remember you are limited on battery size for an xj
it is possible the battery plates have warped and fused togther giving a short circuit and thus draining a lot of the current to ground and causeing the poor running, funnily enough I have known things like that usually happen after a long days use travelling a few 100 miles.
Bought one for my old XJ 12 months ago, proper Mopar jobby, £55 from jeep dealer job done, right size etc etc. Get hold of your local dealer, it may surprise you :lol: