Forum Moderators: open
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> The plain old lang attribute has been replaced in XHTML 1.1 by xml:lang, so if you use the former, it won't validate.
As for the search engines, I can't guarantee they'll recognise xml:lang, though - if it is important, you might want to consider using XHTML 1.0 Strict instead, where you can use this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> Hope that helps!
If you have mixed language content on a page, add the lang="" on the containing block
You're right about this, of course, but when you're using XHTML 1.1, the
lang attribute will not validate. You can use: <p xml:lang="fr">Ceci est en français</p>
But again, I'm not sure search engines (or adaptive technology like braille readers for that matter) will recognise xml:lang. You'd need to check it out before depending on it.
With php..
-----------
<?php
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) { $x = "XML";
header("Content-Type: application/xhtml+xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "\n";
}
else { $x = "normal";
header("Content-Type: text/html; charset=utf-8");
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php
if ($x == "XML") {echo "xml:";}
?>lang="fr">
<head>
----------
dpb
DOCTYPE too, and then you could send an XHTML 1.1 doctype to user agents which accept application/xhtml+xml, and an XHTML 1.0 Strict doctype to the others - then your lang attribute would validate in both cases. (Actually, personally I'd use HTML 4.01 Strict, but that's another debate!) encyclo