Jeep always used an AW-4 automatic transmission with the 4.0L engine, from when the engine was introduced in 1987 right to the last XJ built in 2001. However, around '91 the output spline count went from 21 splines to 23 splines, so an AW-4 from a late model XJ will not mate up with your transfer case. But you could buy the complete tranny and transfer case, and pop the assembly right into an '88.
If the junk yard isn't paying attention, they might be confusing Cherokee with Grand Cherokee. The original GC in 1993 also used the AW-4, but in 1994 the GC started using a Chrysler automatic tranny behind the 4.0L. Perhaps that's what the yard is thinking.
The pre-'87 auto is a Chrysler 904 and it has a small GM bell housing bolt pattern to fit the 2.8L V-6 and 2.5L I-4 engines. It won't even bolt up to a 4.0L block, so it isn't under consideration.