source: xslt/vendor/current/tests/exslt/functions/function.4.xsl@ 372

Last change on this file since 372 was 372, checked in by Yuri Dario, 13 years ago

xslt: initial vendor import of xslt 1.1.26.

File size: 615 bytes
Line 
1<?xml version="1.0"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
4xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func">
5
6<!-- Test a recursive EXSLT function -->
7
8<func:function name="func:factorial">
9 <xsl:param name="n"/>
10 <xsl:choose>
11 <xsl:when test="$n=1"><func:result select="1"/></xsl:when>
12 <xsl:otherwise><func:result select="$n * func:factorial($n - 1)"/></xsl:otherwise>
13 </xsl:choose>
14</func:function>
15
16 <xsl:template match="/">
17 <out><xsl:value-of select="func:factorial(5)"/></out>
18 </xsl:template>
19
20
21</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.