Table of Contents
Switching to XHTML 5
If you want to switch to XHTML 5 and to a application/xhtml+xml
content-type, here is what to do:
Add
xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>"
to the <html>
tag and
<?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"); } else { header("Content-type: text/html"); } ?>
before the doctype in
- ./lib/tpl/<template>/main.php
- ./lib/tpl/<template>/detail.php
- ./lib/tpl/<template>/mediamanager.php
- ./inc/actions.php inside
if($act == 'export_xhtml'){
for the “export_html” mode
Possible issues
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).
Many entities in DokuWiki have been converted to their unicode or numeric entity equivalent, but some might be left.
JavaScript errors
There are quite a few JavaScript errors (documented in the bug tracker as well) when using DokuWiki with an XML content-type.
“XML parsers are permitted to silently remove the contents of comments. Therefore, you should not use comments to “hide” scripts or style sheets.”
<script type="text/javascript" charset="utf-8" ><!--//--><![CDATA[//><!--
Use this instead:
<script>/*<![CDATA[*/ // doing something /*!]]>*/</script>
Check plugins and templates
You should also be aware of the fact that plugins and templates may not take care of strictness or validity at all. So, if your DokuWiki installation uses any of these enhancements, you need to check separately and should make sure they produce valid XHTML and don't use no named entities.
More
See also how to switch to XHTML Strict.