Using the filter function on a repeating element breaks child functions.
Severity
P1 - Critical (Blocking production)
Which Data Mapper Version are you using?
v2
Describe the Bug with repro steps
Expected Behavior:
- Use the filter function on a repeating to repeating mapping
- Have links and links with functions reference the current node, not the full path to include all nodes of that path. Actual Behavior:
- Use the filter function on a repeating to repeating mapping
- Simple links (node to node) work as expected and use the right selection path
- Links with functions use the full path to the source node causing the selection to return all instances of that node, not the current node.
Steps to reproduce:
- Create a source and target schema with repeating nodes.
- Use the filter function to filter the collection based on an expression against an element in the repeating source tree
- Use a function to map one of the child elements of the source to a child of the repeating element on the destination. Something as simple as the Trim string function causes this.
Schema details:
- Source schema type: XSD
- Target schema type: JSON
Screenshots or Videos
Map with no functions works fine
Map with functions only works for simple links as functions reference all nodes of the path, not the current one.
LML with no functions
XSLT with no functions
LML with function (path is wrong for selecting input to the function)
XSLT with function (path is wrong for selecting the input to the function)
Expected LML with functions
Expected XSLT with functions
Environment
- VS Code Version: 1.105.1
- Extension Version: 5.185.10
- Operating System: Windows 11
Are you experiencing a regression?
No response
Map Definition (if applicable)
$version: 1
$input: XML
$output: JSON
$sourceSchema: Source.xsd
$targetSchema: Target.json
$sourceNamespaces:
xs: http://www.w3.org/2001/XMLSchema
root:
$for(filter(/mainResponse/item, string-length(trim(SID)), "!= 0")):
BookingNumber: PIN
StateID: SID
FirstName: replace(/mainResponse/item/FIRST_NAME, "-", "")
Additional context
Using a link between the repeating nodes (no filter) creates the right output but does not exclude the items I want (obviously). I want the filter to work the same way, but just adjust the "select" on the for-each in order to apply the predicate and filter the results.