hy,
In the last message, I've asked
a question about a small factorial program, dynamically written with a
recursive XSLT named-template call and getting a parameter via HTTP
request.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:http="http://xml.apache.org/cocoon/requestgenerator/2.0"> <xsl:template match="/"> <page> <valeur-parametre> <xsl:value-of select="/http:request/http:requestParameters/ http:parameter/http:value"/> </valeur-parametre> <calcul-factoriel> <xsl:call-template name="factorial"> <xsl:with-param name="input" select="/http:request/ http:requestParameters/http:parameter/http:value"/> </xsl:call-template> </calcul-factoriel> </page> </xsl:template> <xsl:template name="factorial"> <xsl:param name="input"/> <xsl:choose> <xsl:when test="$input > 1"> <xsl:variable name="tmp"> <xsl:call-template name="factorial"> <xsl:with-param name="input" select="$input - 1" /> </xsl:call-template> </xsl:variable> <xsl:value-of select="$tmp * $input"/> </xsl:when> <xsl:otherwise> 1 </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
Now, for
training, I just would like to do the same with XSP. So, instead of the
recursive call to the xsl template name, I'de like to use a Java
method:
This one might be the
following:
public static int
factorialize (int input)
{ int result; if (input>1) { result=factorialize(input-1); } else{ result=1; } return input*result; } Problem, I'm new to XSP and I don't
know exactly how to do. I know I have to embeed this code in a
<xsp:logic> element, and get the result with a <xsp:expr> but I
ignore the correct syntax.
Can you give me some
advice?
Thanks,
|
- XSP Problem cyril vidal
- XSP Problem cocoon user
- Re: XSP Problem Lionel Crine
- Re: XSP Problem cocoon user
- Re: XSP Problem Lionel Crine