fn:partition

Partitions a sequence of items into a sequence of non-empty arrays containing the same items, starting a new partition when a supplied condition is true.

partition($input as item()*, $split-when as fn(item()*, item(), xs:integer) as xs:boolean?) ➔ array(item()*)*

Arguments

 

$input

item()*

The input sequence

 

$split-when

fn(item()*, item(), xs:integer) as xs:boolean?

Function determining the condition for starting a new partition

Result

array(item()*)*

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 4.0 Functions and Operators

Saxon availability

Available in XPath 4.0, XSLT 4.0, and XQuery 4.0. Requires Saxon-PE or Saxon-EE. Implemented since Saxon 13. Available for all platforms.