Making WYSIWYG More Standard

It's an old problem: how do you allow users to format text, but still keep the data standards compliant -- in particular XHTML compliant?