I need to transform following xml as Expected Output using xsl 3.0 accumulators.
Input XML:
<AggregatedData>
<Data>
<Entry>
<legacyID>ABC</legacyID>
<legacyLocation>Test_Loc1,Test_Loc2</legacyLocation>
<AssociateID>123</AssociateID>
</Entry>
<Entry>
<legacyID>ABC</legacyID>
<legacyLocation>Test_Loc3</legacyLocation>
<AssociateID>123</AssociateID>
</Entry>
<Entry>
<legacyID>CDE</legacyID>
<legacyLocation>Test_Loc4,Test_Loc5</legacyLocation>
<AssociateID>456</AssociateID>
</Entry>
</Data>
<root>
<row>
<legacyID>ABC</legacyID>
<legacyLocation>Test_Loc1</legacyLocation>
<company>Test Company 1</company>
<firstname>Test1</firstname>
</row>
<row>
<legacyID>CDE</legacyID>
<legacyLocation>Test_Loc5</legacyLocation>
<company>Test Company 2</company>
<firstname>Test2</firstname>
</row>
</root>
</AggregatedData>
Values under <Data> can contain comma separated values for <legacyLocation> and values under <root> only contains one value for <legacyLocation>. I need to map these values and get the output as the Expected Output below. Is there a way to map values using XSLT 3.0 accumulators using both legacyID and legacyLocation?
Expected Output:
<root>
<worker>
<row>
<AssociateID>123</AssociateID>
<legacyID>ABC</legacyID>
<legacyLocation>Test_Loc1</legacyLocation>
<company>Test Company 1</company>
<firstname>Test1</firstname>
</row>
<row>
<AssociateID>456</AssociateID>
<legacyID>CDE</legacyID>
<legacyLocation>Test_Loc5</legacyLocation>
<company>Test Company 2</company>
<firstname>Test2</firstname>
</row>
</worker>
</root>
I think you can use a key like
I don't see why an accumulator would perform better, I would mainly try to use it if you to need to cross-reference with streaming.
A non-streaming use of an accumulator would be