XSL-FO - WordML - XSLT

# The apply element

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

We saw several examples of the apply element under Presentation and content. This is by far the most common content element, since it represents one of the most basic mathematical concepts, that of applying an operator or function to its arguments.

The first child element of the apply element is the operator or function to be applied. The subsequent elements are the arguments of the function or the operands of the operator. The number of subsequent child elements allowed depends on the operator or function specified as the first child element. For example, the plus element can be followed by zero or more child elements while the minus element must have either one or two child elements after it.

The operator or function specified as the first child element of the apply element can be represented in three ways:

• Using one of the existing content elements that represent specific operators or functions.
• Using the csymbol element, as explained under Token elements.
• Using the ci element; for example, you can specify the function f as <ci type="function">f</ci>

Here is a simple example of using the apply element:

``````<apply>
<sin/>
<ci>x</ci>
</apply>
``````

You can easily distinguish two different expressions that look similar but have different mathematical meanings by the number and position of apply elements used in the content markup. For example, the following markup represents the result of applying the sum of two functions f and g to the argument x:

``````<apply>
<apply>
<plus/>
<ci>f</ci>
<ci>g</ci>
</apply>
<ci>x</ci>
</apply>
``````

The following markup represents the multiplication of the sum of two variables f and g with x:

``````<apply>
<times/>
<apply>
<plus/>
<ci>f</ci>
<ci>g</ci>
</apply>
<ci>x</ci>
</apply>
``````