Not to be a putz, but this has been covered (mainly with newer XJ engines into earlier XJs,) here before, so you can get a general idea if you get a little creative with the Search function. I'd toss you a few bones, but I don't recall any of the thread titles offhand.
However, I'm also fairly sure that the TJ accessory mounts may be different, so you will have to account for that (swapping over XJ accessories probably won't fly.) And, note that the alternator used in your 88 was a Delco CS-130 with an internal regulator, the 1997TJ uses a Nippondenso with an external regulator. If you adapt the RENIX controls (1987-1990 XJ/MJ/YJ w/AMC gasoline engine) to drive the 1997TJ OBD-II engine, you'll need to add an external regulator to make the alternator work, unless you retrofit the Delco to the OBD-II engine.
If you decide to bring over the OBD-II controls as well, you'll have to bring over pretty much all of the wiring from the TJ, and you're going to have to adapt most of it from the fuse block forward (if not just all of it.)
Also, note that the heads and manifolds will be different between the RENIX engine and the OBD-II engine - the intake ports are higher in the head, the intake manifold has different accessory mounts, the throttle body is different, the oxygen sensor works on a different principle, the TPS works in the other direction (it's a variable resistance either way - but one works on a decreasing resistance as the throttle opens, and the other increases resistance. I don't recall which is which offhand,) the exhaust manifold is different (not only will there be no provision for the EGR valve - which shouldn't have been installed by the factory anyhow, y'ask me, but the collector will be in a different place and won't work with your OEM downpipe. You'll need to have a new one made,) the oxygen sensor works on a different principle (variable voltage instead of variable resistance used as a voltage divider - but you can go ahead and retrofit an earlier HEGO into a later manifold - they're the same thread, M18-1.5. Plugs will have to be installed in any other bungs that don't have HEGO sensors in them, since RENIX only answers to one. OBD-II usually looks for four...) and a few things I'm not thining of at the moment.
Is it doable? Sure.
Is it difficult? Absolutely.
Is it insurmountable? Depends on skill and tooling available. And experience in fabrication & mechanics. And electronics. And ...
You're letting yourself in for a fun job either way - whether you move the controls over with the engine, or adapt the newer engine to the older controls. Not something you'll be readily able to handle in a week-end...