In order to make this flow work you need to perform the following steps:
1. In the Process Designer create a process flow variable with the following parameter:
Value: Enter numeric value here say 5 (This is equal to number of records you want to split at a time)
2. Use the attached file contents in the Gateway condition in the Process Designer.
3. Create a new mapping activity and load the same schema on both the source and target side and create following 3 local variables at the root element
Value= get-context(startPosition ,1 )
Value= get-context( endPosition,1 )
Value= set-context(totalCount , count( $Input_AdvPos_Invoice/Root/Record_ID_Header-HDR) )
Note: Replace the above xPath with the actual xPath of the source record.
4. Append the following condition to the for-each applied on record:
[position()>=$varStart and position()<=$varEnd]
Note: If the Source xml has multiple elements then you need to add the above for-each statement every target element schema.
Here's a sample process flow diagram:
Also use the rule in the gateway condition