Now that we understand how to markup operands, we need to know how to relate and operate upon them to form an expression. The most fundamental tag for writing Content MathML is the apply tag, which governs the way operations and modifiers are placed in the expression. Take another look at the example above, and you might notice that there are two apply tags. The apply tag is MathML's way of indicating that an operation or relation should be introduced.
The first child of an apply tag is the operation or relation we wish to implement. Colloquially, a child is any element directly within (or "under") an element.
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:plus/>
<m:cn>2</m:cn>
<m:cn>2</m:cn>
</m:apply>
<m:cn>4</m:cn>
</m:apply>
</m:math>
In the code block above, the apply tag is highlighted in bold and the apply tag's first child element is italicized. The apply tag will always understand its first child to be the operation or relation. The operation in this case is plus (addition).
The second child of the apply tag is always the first element being acted upon. There may be even more children depending on what kind of operation is being applied. It wouldn't make any sense to apply sine to two numbers but it does make sense of apply addition to two numbers. For our example, there are two child elements after the plus tag, both of which are cn elements containing "2". So the instruction reads "apply addition to two and two," or
2+2
2
2
It can be difficult to understand the way that apply tags work since MathML doesn't "read" like a typical mathematical expression. Again, remember that Content MathML is focused on applying operations in order to convey semantics. If we were to simply transcribe our Content MathML example onto paper as operations and numbers, it would look something like this:
=
(
+
2
2
)
(
4
)
=
(
+
2
2
)
(
4
)
Equations written in this way are said to be in prefix notation (or Polish notation). It's may seem very counter-intuitive, but computers handle this notation a lot faster than "normal" (or infix) notation.
To expand our understanding of the apply tag in Content MathML, let's look at the topmost apply tag and its children.
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:plus/>
<m:cn>2</m:cn>
<m:cn>2</m:cn>
</m:apply>
<m:cn>4</m:cn>
</m:apply>
</m:math>
The first child of apply is the eq element, which corresponds to equality ("="). The second child, however, is another apply tag. This means that everything inside this second apply tag is the first argument. The third direct child of the first apply tag is a cn containing the number 4. This means that "whatever is in the second apply tag is equal to four."