DokuWikis default doctype is XHTML 1.0 Transitional and its default content-type “text/html”. But with the 2006-03-09 release much attention was paid to making it as strict as possible.
If you want to switch to XHTML 1.0 Strict and/or to a application/xhtml+xml content-type, here is what to do:
If you only want to change the Doctype, just change each Doctype declaration from
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
to
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
in
if($act == 'export_xhtml'){ for the “export_html” modeChanging the doctype to XHTML 1.0 Strict without adjusting the content-type can make sense. But often you would want to change the content-type as well.
As many user agents cannot yet handle a document served as “application/xhtml+xml” (eg. the IE), it is good practice to use content negotiation. So, in all files mentioned above (main.php, etc.) you can put something like this:
<?php if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") || stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator") ) { header("Content-type: application/xhtml+xml"); header("Vary: Accept"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"; echo " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; } else { header("Content-type: text/html"); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"; echo " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; } ?>
Or you can find other solutions searching the web that suits your purpose better.
The test for W3C_Validator is recommended since the validator currently doesn't use content negotiation. The vary header avoids problems where a proxy server otherwise might serve a cached xml version to a non xml compliant browser.
Another (quite big) issue that has to be taken care of, if you decide to switch to an xml content-type, concerns entities.
In XML no other named entities than <, >, " and & should be used (otherwise it may lead to parsing errors, ie. the page won't be displayed at all). In the case of DokuWiki I recommend to replace each visible named entity to its utf-8 character; and each non-visible named entity (like ) to its numeric entity (preferably decimal).
That is the trickier part of converting to Strict.
Maybe someone can write a script that does that!?
You should also be aware of the fact that plugins, templates, etc. may not take care of strictness at all! So, if your DokuWiki installation uses any of these enhancements, you should make sure they produce strict xhtml.
A good starting point is this page.
As far as it comes to XHTML 1.1, if it is XHTML 1.0 strict there is a pretty good chance that is is valid XHTML 1.1. The biggest point of XHTML 1.1 is that they (W3C) disallowed the transition XHTML. To make your wiki XHTML 1.1 conform use the trick noted above but replace the DTD with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">.
Sean Farrell sean.farrell@digital-egg.org