HTML and CSS Reference

In-Depth Information

If and when you need to include math markup, use the
xmlns
attribute

again to define the math namespace. So, for instance, you could use the

xmlns
attribute within some math-specific tag of your otherwise common

XHTML document (assuming the
MATH
element exists, of course):

<div xmlns="http://www.w3.org/1998/Math/MathML">x2/x</div>

In this case, the XML-compliant browser would use the
ht-

tp://www.w3.org/1998/Math/MathML
namespace to divine that this is

the MATH, not the XHTML, version of the
<div>
tag, and should therefore

be displayed as a division equation.

It would quickly become tedious if you had to embed the
xmlns
attribute

into each and every
<div>
tag anytime you wanted to show a division

equation in your document. A better wayparticularly if you plan to apply

it to many different elements in your documentis to identify and label

the namespace at the beginning of your document, and then refer to it

by that label as a prefix to the affected element in your document. For

example:

<html xmlns="http://www.w3.org/TR/xhtml1"

xmlns:math="http://www.w3.org/1998/Math/MathML">

The
math
namespace can now be abbreviated to "math" later in your

document. So the streamlined:

</math:div>x2/x</div>

now has the same effect as the lengthy earlier example of the math
<di-

v>
tag containing its own
xmlns
attribute.

The vast majority of XHTML authors will never need to define multiple

namespaces and so will never have to use fully qualified names contain-

ing the namespace prefix. Even so, you should understand that multiple