I'm agonizing over the same decision. Image quality will be the same or similar but there are differences. Off the top of my head:
- Build. The 40D is a tank compared to the XSi. Larger, heavier and more metal. This may or may not make a difference in durability. Weight could be a factor.
- Shutter Speed. 1/8000 for 40D, 1/4000 for XSi.
- Shutter Rating. 40D shutter rated for 100,000 actuations vs 50,000 of the XSi.
- ISO. 40D will do 3200 vs the 1600 of the XSi.
- Frames Per Second. 40D will do 6.5 fps vs. 3.0 fps. That can make a difference in high speed activities like sports shooting. The buffer in the 40D is also larger for continuous shooting (both RAW and JPEG).
- sRaw. Available on 40D only.
- Megapixels/Sensor. Both use the DIGICIII but the XSi produces 12 MP images vs. 10MP for the 40D. Unless you're making poster size prints this is a negligible difference. It can be an advantage when cropping images but same sensor, more pixels can also equal more "noise".
- Storage media. SD for XSi and Compact Flash for 40D.
There are many more differences which may or may not factor into your decision. Your own level of expertise and enthusiasm may dictate your choice as well. In the end either will take great images. That is probably true of many in the Canon line below those models (XS, XT, 30D, 20D). More megapixels does not mean better images. Your understanding of the process and the equipment are the biggest factor.
I would suggest reading to your heart's content on dpreview.com or any of the other various sites. With the 50D just announced the 40D should drop a bit or be widely available used from the early adopters. The body is already available for less than $1K. Tough decision.