Are you out of your mind? Why would anyone want to go from a 6 to a 4? To save gas? The cost of the swap would NEVER be recouped in the form of fuel savings.
You need an entirely different computer and wiring harnesses from a 4-cylinder Xterra, plus the transmission and transfer case from a 4-cylinder 4WD Frontier since the V6 transmission won't mate to the 4-cylinder engine, nor are the transfer cases interchangeable between 4 and 6 cylinder models. Also, the V6 4WD's R200A front differential won't clear the 4-cylinder's oil pan, the 4-cylinder 4WD Frontier had the R180 diff.
_________________________
Tip: see if your question has already been answered before asking it. Try our handy-dandy search tool!