Windows XP will allow up to around 8GB of RAM if you have a 64bit edition.
But alike Vista and Windows 7, the memory allocation table in 32bit OS's cannot handle more than 3GB. If you do put the full 4GB into the 32bit OS, only 3GB will be visible and usable on the machine and the other 1GB will be allocated to background caching and video RAM (as it cannot be directly assigned to the OS).
What I would say is... if you are thinking of going to a 64bit OS, do not under any circumstances go to XP 64bit. The majority of the processes are still in 32bit and the entire OS was hacked together to make it compatible at the most basic level for the 64bit subsystem. If you want to have a full 4GB and actually use it, you REALLY should be using Windows 7. Not only will the 64bit version allow you to use that full 4GB (rather than giving you partial access to it), the OS is MUCH more optimized than XP, especially in allocating larger subsets of RAM and you are likely going to find the OS perform much better.