11.4 Conditionals 269
Transform 11.5 A template that adds theidof the containing element as a new
attribute
operator is short for “division.” Programming languages often use the slash
to denote division. Obviously one cannot use the same notation because that
would conflict with the use of slash to denote navigation.
Navigating from a child to a parent uses the same notation as in directories.
In transform 11.5, an attribute is added to theinteractionelement that
has the identifier of the correspondingProteinelement.
The XSLT language inherits all of the operators that are available in XPath,
such as the ones in table 8.1. Two operators that seem to be missing are the
maximum and minimum operators. In fact, both of these can be computed
by using thexsl:sortcommand. This is explained in the next section.
Summary
- XSLT navigation is the process of traveling from one element or attribute
to another one in the document. - Navigation is specified using the same notation as in directory trees.
- Computations are specified using operators, such as the ones shown in
table 8.1
11.4 Conditionals
Conditionals are used to define special cases. For example, in section 1.1
the health study record defined normal weight, overweight, and obesity in
terms of ranges for the body mass index (BMI). In XSLT these ranges would
be written like this: