Monday, October 9, 2023

#988 OIC3 23.10 - xsl:for-each-group

 














Here is a simple example, in which I will read the following file - 


The goal is to parse this file and extract distinct band names. 

Ergo, grouping will be done based on band name e.g. Jethro Tull.

Again, the output file should just include distinct band names, in my case, the following - Jethro Tull, Horslips, Pink Floyd.


The input file, albums.xml, will be read via the FTP adapter, I then write the output file, which will have the following structure - 


 






for-each-group will be used in the mapper, so here is the map definition - 



Here are the settings - 

for-each-group is set to album
group-by is set to @band
name is set to band

I run the integration and check the output file - 





No comments: