I haven't used either of the cameras you're asking about. But I've used the Nikon D40X and the Canon XTi and XSi. Based on my experience with the Nikons and Canons, I think either camera will serve you well. Honestly, it's mostly a matter of personal taste. There are no bad digital SLRs anymore. You are buying into a system and it may be that one camera or another has a feature that you prefer. But both the D40 and the XS will take great pictures.
An alternative is to look at the Sony, Olympus, and Pentax cameras that hollis mentioned. Those camera makers all apply image stabilization at the sensor - the sensor moves instead of elements in the lens. That means you don't have to buy special lenses to get the benefit of mechanical image stabilization. My personal choice from those three would be the Olympus E-520. I like it for its extra compact body size.