if you do a 99 up engine in an older XJ, you'll have to rewire. it origionally had an OBD1 computer system, 1996 and up have OBD2.
as far as the transmission, no idea, but i presume the transmissions are different enough (obd1 vs obd2) to cause a problem. physical demensions will be fine, but electrical might get you in the end.