Skip to Content
0
Former Member
May 18, 2018 at 07:31 PM

XSLT mapping - split in individual records from complex input xml

512 Views Last edit May 18, 2018 at 07:36 PM 2 rev

Hi Everybody,

I want to split up individual records from a complex xml output by XSLT mapping.

Below is input xml:

<EmployeeTime> <EmployeeTime> <userId>100</userId> <timeType>A</timeType> <timeCalendar> <EmployeeTimeCalendar> <date>2018-05-10</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> </timeCalendar> </EmployeeTime> <EmployeeTime> <userId>110</userId> <timeType>B</timeType> <timeCalendar> <EmployeeTimeCalendar> <date>2018-06-05</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> <EmployeeTimeCalendar> <date>2018-06-06</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> </timeCalendar> </EmployeeTime> </EmployeeTime>

Output should be like:

<EmployeeTime> <EmployeeTime> <userId>100</userId> <timeType>A</timeType> <timeCalendar> <EmployeeTimeCalendar> <date>2018-05-10</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> </timeCalendar> </EmployeeTime> <EmployeeTime> <userId>110</userId> <timeType>B</timeType> <timeCalendar> <EmployeeTimeCalendar> <date>2018-06-05</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> </timeCalendar> </EmployeeTime> <EmployeeTime> <userId>110</userId> <timeType>B</timeType> <timeCalendar> <EmployeeTimeCalendar> <date>2018-06-06</date> <quantityInHours>8</quantityInHours> </EmployeeTimeCalendar> </timeCalendar> </EmployeeTime> </EmployeeTime>

Can you please advise how to achieve this in XSLT.

Regards,

Matt