I too have owned my rig since new, and while it has zero problems currently, at 265K miles I am trying to learn all I can. I suggest you google RE5R05A as there are a lot of good threads on other forums, both for other vehicles as well as generic trans forums. The transmission was very popular.
My limited understanding is that:
All the RE5R05A are basically the same. However there are at least 3 planetary arrangements (representing different gearing for different applications), and that there are multiple TCM's. I would think its safe to assume all 4WD Xterra's have the same planetary?? however its completely feasible they changed the TCM at some point.
A few people seem to say a reflash is required of the TCM on replace, but some say it is not. It seems that a new TCM definitely requires a flash, but there sold blank. I can't find anything definitive. A number of people I read simply removed the valve body from their old trans (which contains the TCM) and installed it in the new trans?
Good luck. Please post back what you find out in the end for the rest of us!