My '02 5-speed whined in 5th gear when I got it new. Took it to Nissan and they replaced it under warranty at 10K miles. The new one started whining and then they said it's a "characteristic of the vehicle." It kept whining but ran fine.
About 18 months ago (about 110K miles) I had the transmission serviced at a local shop and they only refilled it halfway. I'd usually check that kind of thing but Nissan in their wisdom made it a "raise the vehicle, pull the plug, and stick your finger in" thing. Unbelievable that a modern vehicle manual would literally tell you to check a fluid by sticking your finger in.
Needless to say my transmission was soon ruined. They replaced it with a used transmission that I suspect is from a Frontier or other compatible vehicle (i.e. not an X) and it doesn't whine nearly as loudly. On the other hand, my speedometer reads about 3 mph high. Can't complain though because when I drove by that mechanic's shop less than 2 weeks after they replaced my transmission, it had gone out of business. They could've easily stiffed me and said "Too bad, sue us."
Truck runs great at 127K miles so all things considered I made out ok.
Oh yeah, the bottom line is, Xterra 5-speeds whine in 5th gear. If yours is doing it in all gears it could be trouble but they're just not quiet transmissions to begin with.