saxon:items-from
Returns the subsequence of the input starting with the first item that matches the predicate.
items-from($input as item()*, $predicate as function(item()) as xs:boolean) ➔ item()*
Arguments | |||
| $input | item()* | The input sequence |
| $predicate | function(item()) as xs:boolean | Function determining the start condition |
Result | item()* |
Namespace
http://saxon.sf.net/
Saxon availability
Requires Saxon-PE or Saxon-EE. Implemented since Saxon 10.
Notes on the Saxon implementation
Available from Saxon 10.
Details
This function returns a contiguous subsequence of the input sequence, starting with the first item
that matches the $predicate
condition, and ending at the end of the input sequence.
If no item in the input sequence matches the $predicate
condition,
the result is an empty sequence.
If the first item in the input sequence matches the $predicate
condition,
the entire input sequence is returned.
Example: saxon:items-from(1 to 20, function($x){$x mod 10 = 0})
returns the sequence 10 to 20
.
In XSLT, calls on saxon:items-after
are streamable provided that the function supplied as the
predicate is either (a) a reference to a user-declared stylesheet function declared with streamability="inspection"
,
or (b) an inline function whose body is grounded and motionless. More specifically, if the predicate function
satisfies these conditions then the posture and sweep of the function call are the same as the posture and sweep of
the first argument.
Example: /*/emp => saxon:items-from(function($e){$e/@dept='sales'} =>
saxon:items-before(function($e){$e/@dept='QA'}