First of all im trying to help you out, and secondly it was not very clear so I asked. Yes it does matter, and yes I've been there, done this so im just trying to give you a heads up.
The 97 is pretty much the bastard year of the XJ, it uses some parts and wiring that are incompatible with the the rest of the 98-01. The transmission plugs and wires on the 97 do not match the 01 as there are less wires and less sensors on the 97 transmission.
Actually, The 97 interior harness is completely different than the 98-01 harness as far as the trans goes and uses a specific 97 TCU, splicing this will cause electrical gremlins for this specific setup. You would need to swap all wiring over from the 2001 to the 97 body, including interior and dash.
some good info here post #19 and #39:
http://www.naxja.org/forum/showthread.php?t=1039728
and here about the 97 body:
http://www.naxja.org/forum/showthread.php?t=1053970