|
Subject: [xsl] XPath 3.0: Is it possible to do recursion in an anonymous function? From: "Costello, Roger L." <costello@xxxxxxxxx> Date: Sat, 13 Oct 2012 19:03:22 +0000 |
Hi Folks,
Is it possible to do recursion in an anonymous function?
Example: I would like to implement an "until" function. It has three
arguments:
1. p is a boolean function
2. f is a function on x
3. x is the value being processed
Read the following function call as: decrement 3 until it is negative
$until ($isNegative, $decrement, 3)
where
$isNegative := function($x as xs:integer) {$x lt 0}
$decrement := function($x as xs:integer) {$x - 1}
Here's how I attempted to implement function until:
$until := function(
$p as function(item()*) as xs:boolean,
$f as function(item()*) as item()*,
$x as item()*
) as item()*
{
if ($p($x)) then
$x
else
$until($p, $f, $f($x)) <-- RECURSE ...THIS
IS NOT ALLOWED, I THINK
}
Is there a way to implement function until in XPath 3.0? (I know how to
implement it in XSLT 3.0)
/Roger
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] RE: [xquery-talk] deduplicati, Robby Pelssers | Thread | Re: [xsl] XPath 3.0: Is it possible, Dimitre Novatchev |
| Re: [xsl] deduplicating information, G. Ken Holman | Date | Re: [xsl] XPath 3.0: Is it possible, Dimitre Novatchev |
| Month |