I am using the XHTML Strict doctype for my website. Some of the site content is generated from a MySQL database. The data, for essays, articles, etc., is plain text but interspersed with HTML code for links and images. For XHTML strict, I need to convert characters like '&' to '&' and '>' to '>'. So, 'Mary & John' becomes 'Mary & John'. Some of the URLs have '&' in them, and I need to convert them to '&' too. (XHTML-compliance requirement). When I try the htmlspecialchars() function, it converts everything, including the link codes (such as the '<' in '<a href=...').
Any suggestions on how I can achieve this 'rendering'? I don't want to modify the MySQL data.