11.7 Procedural Programming 279
$elements[position()=$i]"/>
Here is an example of how this procedure would be called:
As this example suggests, XSLT can be used for numerical computations
provided the computations are not too complicated. When the computations
get complex, it would be better to use software tools and languages that are
designed for such computations (such as Perl).
Summary
- XSLT can be used for traditional procedural programming.
- Variables are declared by using anxsl:variableelement.
- Procedures are templates that have a name. The parameters of a proce-
dure are declared by usingxsl:paramelements. - Procedures are called by using anxsl:call-templateelement. Pa-
rameters are passed to the procedure by usingxsl:with-paramele-
ments. - Although one could implement complex numerical algorithms in XSLT, it
is probably easier to use programming languages and tools that are de-
signed for such algorithms.