====== Fragment large messages ====== If a message cannot be processed by a receiving system due to the number of positions, then it is useful to split it into smaller fragments using a mapping. Here we access the XPATH native "predicate" function **position()**. This function allows to select dedicated children of the parent node by index. Furthermore, a special feature of the so-called mapping rulesets is used where the behavior is set as a while loop, ===== Create prerequisite ===== First, the maximum number of positions within a message to be generated is defined and a counter variable is initialized to the value 1. Then, initially, the smallest and largest index within the first class must also be determined. Furthermore we determine the resulting number of single messages to be expected. ===== Loop with rule set ===== Now in a new rule set, which is set with the **Rule behavior="WhileLoop "**, the loop condition can be checked. This simply checks whether the maximum number of passes has been reached or not. ^Name ^Selection ^Target ^ |**rs_**WhileLoop((the prefix "rs_" usually: always indicates a **R**egel**S**set.))|$counter < $TargetObjectCounts+ 1((In the absence of a boolean comparison operator "<=", the upper class limit is increased by 1 and compared with "<". ))|**/TargetObjectRootName((Triggers the target object as many times as the WhileLoop is executed.))**((In this example, recalculates further down the footer in the loop. This can be solved alternatively.))|. **Important**: this rule set now triggers the target object. Subsequently, the classified items are then filtered using the XPATH child index. ===== Sample Mapping ===== A corresponding mapping or ruleset construct can be set up as follows: ==== snapshot ==== {{:howtos:mappingfragments.jpg?nolink|}} ==== XML Code ==== The mapping shown in the snapshot is available here in the code as clipboard XML and can be copied and pasted into any mapping. EBISS_MAP_ITEMS