So, hypothetically speaking, I have a user, some guy on the internet, who goes to my website and requests mysite.com/resource; it points to a PHP script that follows this outline:
1) Tests whether or not the user agent can understand application/xhtml+xml.
2) uses XML functions to load resource.xml.
3) If the user agent can do as asked in #1, outputs a valid XHTML document (including MIME type, trailing slashes for empty tags, CDATA blocks, and so on).
4) If the user agent cannot do as asked in #1, outputs a strictly valid HTML document, where trailing slashes in empty tags are interpreted as minor errors on the author's part, but shorttags are permissible if used correctly.
So anyway, I could do this using a bunch of custom functions, but I was wondering if there were any shortcuts or library functions that would allow me to more quickly output strictly valid text. Or possibly something like server-side parsing of XSLT?