Before you change the tranny, you can try the following things to get it to work (easiest to less easy):
- Check the transmission fluid level, park car on level surface, engine idling, tranny warm, in NEUTRAL (not park), only use ATF+4 to top-up.
- Drop the tranny pan, inspect pan bottom for shavings/chunks of metal etc. Anything more than grey powder is no good; replace the tranny filter, change the tranny oil (3-4 gallons required for full change, use ATF+4)
- Replace the governor solenoid and pressure sensor assembly, they're known to go bad and cause crappy shifting.
The best place to get a cheap ZJ tranny is a self-service junkyard, they go for about $150-200. You can also negotiate with them to organise a swap if the one you pull is no good.
No other trannies are an easy fit to a ZJ. AW-4 automatic from XJ and AX-15 manual from old ZJ are bolt-ins to 4.0 engine, but they all give grief with the electric side - permanent check engine light. Don't know about what bolts up to 5.2 engine.