xsl-list
[Top] [All Lists]

Re: [xsl] New XSLT 3.0 Working Draft

2012-07-11 05:31:41

On 11/07/2012 10:12, Ihe Onwuka wrote:

Sorry I meant partial application and you must forgive my syntax
because I have no idea what it should be but in

<xsl:variable name="f" as="function(xs:integer, xs:integer) as
xs:integer" select="1"/>

if  the function in the above variable is a function that adds two
integers then $f(3) returns 4 (i.e $f becomes a function that
increments it's argument by 1).



If f is a function that takes two arguments and adds them, so that f(2,3) is 5, then f(?,1) is a function that takes a single argument and adds one to it.

You might write this as

<xsl:variable name="fAdd"
select="function($x as xs:integer, $y as xs:integer) as xs:integer {$x + $y}"/>
<xsl:variable name="fIncrement" select="$fAdd(?, 1)"/>
<xsl:value-of select="$fIncrement(4)"/>

which would output "5".

Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--