DIN is the standard chassis size used for most autosound applications.
Unfortunately, automakers took a good thing and found a way to screw it up - there are now three sizes.
DIN - the standard (rectangular) shape used in probably 85% of vehicles. What you ain't got, but can have with an adapter.
DIN-and-a-half, or 1-1/2-DIN - this is the odd size in the middle. As you've probably guess before you finished reading this, this is 1.5 times the height of the regular DIN chassis - but the same width. If you don't want to use an adapter, this is what you need - it's pretty much a ChryCo staple (and some Japanese imports use it as well.)
Double-DIN - this is (I'm sure you're getting there...) exactly twice the height of the DIN - but the same width. I've seen this with various "high-end" applications, and some luxury vehicles that integrate a number of functions into the head unit.
Start Here - you didn't mention if you had Infinity, Non-Infinity 2-speaker, Non-Infinity 4-speaker (a quick look at the head unit should tell you if it's an Infinity or not. Check the front doors and the rear hatch area for speakers. It is also possible that the rear speakers are mounted in an overhead "sound bar" rather than in the hatch.) If you get stuck, just go to crutchfield.com and follow the lines to get where you want.
The electrical connection is non-standard - everyone uses their own. Another advantage to dealing with a major house - they have all the electrical adapters as well. You will take the harness for the head unit (designed to crimp into the OEMR wiring and plug into the head unit) and the adapter harness (designed to plug into the OEM wiring and crimp to whatever you're connecting) and use the two to make an adapter that will go from the head unit to the OEM wiring.
I like to use "bullet plugs" or "spade plugs" when I do this, as it allows me to change the head unit later without having to get a new harness.
You have the option of getting a "DIN to DIN-and-a-half" adapter and using a standard DIN head unit, or getting a DIN-and-a-half head unit and dropping it right in. Once you see how to get in there, it's not too hard.
I can't tell you how to tear into the dashpanel itself offhand, since I don't have an XJ newer than 1989. However, if you get stuck, I do have a 1997FSM somewhere, and that should work for your 98.
Good luck!
5-90