In the Graphical Data Mapping editor, you can use the fn:string-join transform to create an output element that is the result of concatenating a sequence of input elements with a delimiter as optional.
The XPath 2.0 function fn:string-join(arg1, arg2) takes two arguments, converts them to their string representation, and concatenates them, returning a single string.
The fn:string-join transform is the representation of the fn:string-join XPath function in the Graphical Data Mapping editor.
You can have any number of inputs to the fn:string-join transform. These inputs can be used to define the arguments of the fn:string-join function.
In the following figure, the fn:string-join transform has one input. The input is used to define the first argument of the fn:string-join function. No delimiter is configured.
The following figure shows the fn:string-join transform with one repeating element as input, and a separator. To add the delimiter, you must select the General tab in the Properties view, click Edit, and then enter the value.
The Cardinality property determines the elements (also known as indexes) in the repeating input element that are processed by the fn:string-join transform.
You can configure the Input array indexes section to select specific instances of the input array. For more information, see Selecting the indexes of input array elements.
When the instances that you need to concatenate need to be calculated at run time based on a condition, you can filter dynamically the input indexes by defining a custom XPath conditional expression for the first argument named strings in the General tab. The expression determines which elements of the repeating structure are applied at run time.
For example, to calculate the value of the output element a, you must concatenate the elements in the repeating structure C whose length is greater than 4. You can use the following XPath expression:
$C2[fn:string-length() > 4]
You can use any of the input elements to the fn:string-join transform to define a conditional expression that defines the condition under which the transform is applied. If the condition evaluates to true, the transform is applied.
For more information, see Configuring the properties of a transform.