Calculation of trigonometric sine function
Do not use power and factorial. Notice that


  $$x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots = x(1 - \frac{x^2}{2*3}(1 - \frac{x^2}{4*5}(1 - \frac{x^2}{6*7}(1 - \ldots))) \ldots) $$


Now calculate it backwards from the innermost term:

  &lt;!-- sin(x) = x(1 - (x^2/2*3)(1 - (x^2/4*5)(1 - (x^2/6*7)))) --&gt;
  &lt;xsl:template name="sin"&gt;
    &lt;xsl:param name="degrees" /&gt;
    &lt;xsl:param name="radians" select="$degrees * $PI div 180" /&gt;
    &lt;xsl:param name="iter" select="31" /&gt;
    &lt;xsl:param name="result" select="1" /&gt;

    &lt;xsl:variable name="term" select="($radians * $radians) div (($iter - 1) * $iter)" /&gt;

    &lt;xsl:choose&gt;
      &lt;xsl:when test="$iter &amp;gt; 2"&gt;
        &lt;xsl:call-template name="sin"&gt;
          &lt;xsl:with-param name="radians" select="$radians" /&gt;
          &lt;xsl:with-param name="iter" select="$iter - 2" /&gt;
          &lt;xsl:with-param name="result" select="1 - ($term * $result)" /&gt;
        &lt;/xsl:call-template&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;&lt;xsl:value-of select="$radians * $result" /&gt;&lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;