diff options
Diffstat (limited to 'libxslt/tests/exslt/functions/function.4.xsl')
-rw-r--r-- | libxslt/tests/exslt/functions/function.4.xsl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libxslt/tests/exslt/functions/function.4.xsl b/libxslt/tests/exslt/functions/function.4.xsl new file mode 100644 index 0000000..59a084f --- /dev/null +++ b/libxslt/tests/exslt/functions/function.4.xsl @@ -0,0 +1,21 @@ +<?xml version="1.0"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func"> + +<!-- Test a recursive EXSLT function --> + +<func:function name="func:factorial"> + <xsl:param name="n"/> + <xsl:choose> + <xsl:when test="$n=1"><func:result select="1"/></xsl:when> + <xsl:otherwise><func:result select="$n * func:factorial($n - 1)"/></xsl:otherwise> + </xsl:choose> +</func:function> + + <xsl:template match="/"> + <out><xsl:value-of select="func:factorial(5)"/></out> + </xsl:template> + + +</xsl:stylesheet> |