I am working on a site and working on a component that will take users using wap or xhtml-mp and redirect them to sites specifically setup for those devices. Is there a good standard way of detecting which of these the user is using?
Because no matter what you do you WILL get it wrong sooner or later, each version of the site should include a link to a page where the user can choose an appropriate format. Once they chose, cookie them and, if present, use that cookie as an override to whatever user-agent sniffing would have told you.
In addition to user agent sniffing if your site involves logging in you can store that preference permanently and re-cookie them, if needed, upon login. If it's obvious from the user agent string just use that, if it's not, ask them to choose from a list of your available options and store their choice as the default.