11.3 Navigation and Computation 267
Transform 11.3 A modification of the program in transform 11.1 in which the
interactionelements contained inProteinelements are changed toIelements.
All other kinds of child element in aProteinelement are lost.
interactionelements would be lost. This would not occur if the trans-
formation of theinteractionelements were done using another template.
The onlyinteractionelements that will be transformed by thefor-each
command are the ones that are child elements of aProteinelement.
Nevertheless, thefor-eachcommand is useful, especially when one is
performing numerical calculations. This is the topic of the next section.
Summary
- A transformation action occurs in a context: the element or attribute being
transformed. - The context is normally chosen in the same order in which the elements
or attributes appear in the document, but which can be changed by using
asortcommand. - The context is changed by using either anapply-templates(rule-based)
command or afor-each(traditional iteration) command.
11.3 Navigation and Computation
Like any programming language, one can perform numerical computations
using XSLT. This is specified using a notation similar to that in traditional