For more info on XQuery singleton issues
My fellow SDET John Gallardo has written this follow up to the post I wrote yesterday about singleton errors. John digs a bit deeper, and addresses performance issues. He also goes over the use of the DOCUMENT property and its effects on static typing. If you're an XQuery user, you will undoubtedly find this information useful.