Subject: RE: Designs for XSLT functions (Was: Re: RE: syntax sugar for call-template)
From: "Kaganovich, Yevgeniy (Eugene)" <ykaganovich@xxxxxxxxxxx>
Date: Tue, 20 Feb 2001 14:38:11 -0800
|
I worked on a similar implementation for calling SQL stored procedures. To
do that I had to support mutiple output parameters as well as multiple
inputs. I think this is useful functionality to have in general...
First, using unabbreviated form and seriously pumping up xsl:call-template
syntax (I am sorry to admit that I lost track of whether the function
proposal is still being considered on top of xsl:call-template, or as a
separate entity)
<xsl:template match="*">
<xsl:bound-variable name="ret"/>
<xsl:call-function name="f">
<xsl:with-param name="input1">5</xsl:with-param>
<xsl:bind-output-variable name="output1" bound-name="r"/>
</xsl:call-function>
<xsl:value-of select="$ret"/>
</xsl:template>
<xsl:function name="f">
<xsl:param name="input1"/>
<xsl:output-variable name="output1">
<xsl:value-of select="$input1"/>
</xsl:output-variable>
</xsl:template>
I'm sure better naming conventions could be chosen, but I hope the idea is
clear.
In abbreviated form, someone suggested var := value syntax for input
parameters; I think this is a great idea, and for output parameters, var =:
bound-name makes sense...
xf:call('f', 'input1 := 5', 'ret =: output1')
For return value, in my simple case (SQL cannot return nodesets), I just
took one of the output variables and said I'll use it as return value
(another , but I don't have a preference on how to do it...
Just a thought.
- Eugene
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|
Kaganovich, Yevgeniy (Eugene) - Tue, 20 Feb 2001 17:31:20 -0500 (EST) <=
Joe English - Tue, 20 Feb 2001 22:06:37 -0500 (EST)
|
|