<xsl:function name="math:factorial"
xmlns:math="http://www.example.com/math"
exclude-result-prefixes="math">
<xsl:param name="index" type="xsd:nonNegativeInteger"/>
<xsl:result type="xsd:positiveInteger"
select="if ($index eq 0) then 1
else $index * math:factorial($index - 1)"/>
</xsl:function>