Reputation: 25
Here is XHTML 1.0 Transitinal DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
</body>
</html>
following the xml namespace attribute,can I change the xml:lang and lang to another value,such as other language?how it works?Thanks guys!
Upvotes: 1
Views: 386
Reputation: 724542
The xml:lang
attribute is simply the lang
attribute that corresponds to XML itself (xml
being its namespace). Since XHTML derives from XML, elements in an XHTML document must have the xml:lang
attribute, along with the HTML lang
attribute. You usually just declare xml:lang
on the <html>
opening tag and everything else inside will "inherit" the language value appropriately.
If you need to specify a different language, make sure to specify the same value for both attributes.
This is stated in the XHTML 1.0 spec:
Use both the
lang
andxml:lang
attributes when specifying the language of an element. The value of thexml:lang
attribute takes precedence.
Upvotes: 2