Modules | Category: example This use case tests a recursive function. Use CaseSource (view)<doc> <section index="section1" index2="atr2val"> <section index="subSection1.1"> <p>Hello</p> <p>Its me again.</p> </section> </section> <section index="section2"> <p>Jam</p> <section index="subSection2.1"> <p>Marmalade</p> <p>And Honey</p> </section> <section index="subSection2.2"> <p>With peanut butter</p> <p>On toast</p> </section> <p>Delicious!</p> <section index="subSection2.3"> <p>Full up now?</p> <p>You bet.</p> </section> </section> </doc> Stylesheet (view)<!-- 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> Result (view)<out>120</out> Change HistoryPrevious Version: ..NaN.html
|
http://www.exslt.org/func/elements/function/func.function.use-case.4.html last modified 2001-04-28