I have a requirement to print consequently dated time offs of the same type into a single row with total time off being sum of units of each time off row and a start date having the start date of the oldest time off row and the end date being the latest time off row start date based on an XML below.
--XML--
<?xml version='1.0' encoding='UTF-8'?>
<Data>
<Worker>
<Worker_ID>12</Worker_ID>
<Time_Off>
<Type>Compassionate Leave</Type>
<Date>2018-02-09-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Compassionate Leave</Type>
<Date>2018-02-08-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Compassionate Leave</Type>
<Date>2018-02-02-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Compassionate Leave</Type>
<Date>2018-02-01-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Statutory Holiday</Type>
<Date>2018-02-07-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Statutory Holiday</Type>
<Date>2018-02-06-08:00</Date>
<Units>1</Units>
</Time_Off>
</Worker>
<Worker>
<Worker_ID>09</Worker_ID>
<Time_Off>
<Type>Sick Leave</Type>
<Date>2018-02-10-08:00</Date>
<Units>1</Units>
</Time_Off>
</Worker>
<Worker>
<Worker_ID>13</Worker_ID>
<Time_Off>
<Type>Vacation</Type>
<Date>2018-02-11-08:00</Date>
<Units>1</Units>
</Time_Off>
<Time_Off>
<Type>Vacation</Type>
<Date>2018-01-10-08:00</Date>
<Units>1</Units>
</Time_Off>
</Worker>
</Data>
-Desired Output--
EmployeeID,TimeOff Type,TimeOff Start Date,TimeOff End Date,Total Units
12,Compassionate Leave,2018-02-08,2018-02-09,2
12,Compassionate Leave,2018-02-01,2018-02-02,2
12,Statutory Holiday,2018-02-06,2018-02-07,2
09,Sick Leave,2018-02-10,2018-02-10,1
13,Vacation,2018-02-11,2018-02-11,1
13,Vacation,2018-01-10,2018-01-10,1