Я новичок в XSLT и у меня есть требование скопировать дочерний узел и поместить его в другой узел на основе совпадения идентификатора сотрудника?
Оба узла имеют EmpID и должны быть скопированы.
Workers_Data -> узел LeaveStatus (только когда EmpID соответствует) wd: ChangeEventSummary-> wd: ChangeEvent-> wd: EventDetails и сохранить весь отчет как есть.
<?xml version='1.0' encoding='utf-8'?>
<wd:Census_Report xmlns:wd="urn:com.workday/bsvc">
<wd:Workers>
<wd:Worker_Data xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wd:EmpID>50211</wd:EmpID>
<wd:LeaveStatus> <!--This entire node need to copy to
EventDetails-->
<wd:LeaveDetail>
<wd:LOA_Start_Date>2017-12-22</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-01-22</wd:LOA_End_Date>
</wd:LeaveDetail>
<wd:LeaveDetail>
<wd:LOA_Start_Date>2018-02-20</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-03-02</wd:LOA_End_Date>
</wd:LeaveDetail>
</wd:LeaveStatus>
<wd:Allocation_Details>
<wd:AllocationInstance>
<wd:Costing_ID/>
<wd:Start_Date/>
<wd:End_Date/>
<wd:Costing_Allocation_Data>
<wd:Allocation_Order/>
<wd:Cost_Center_Allocation/>
<wd:Region_Allocation/>
<wd:Location_Allocation/>
<wd:Distribution_Percentage/>
<wd:Default_from_Organization_Assignment/>
</wd:Costing_Allocation_Data>
</wd:AllocationInstance>
</wd:Allocation_Details>
</wd:Worker_Data>
</wd:Workers>
<wd:ChangeEventSummary>
<wd:ChangeEvent xmlns:xs="http://www.w3.org/2001/XMLSchema">
<wd:EmpID>50211</wd:EmpID>
<wd:TermDate>2018-04-27</wd:TermDate>
<wd:EventDetails/><!--Paste the Leave Status inside this node -->
</wd:ChangeEvent>
</wd:ChangeEventSummary>
</wd:Census_Report>
Ожидаемый результат, как показано ниже:
<?xml version='1.0' encoding='utf-8'?>
<wd:Census_Report xmlns:wd="urn:com.workday/bsvc">
<wd:Workers>
<wd:Worker_Data xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wd:EmpID>50211</wd:EmpID>
<wd:LeaveStatus>
<wd:LeaveDetail>
<wd:LOA_Start_Date>2017-12-22</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-01-22</wd:LOA_End_Date>
</wd:LeaveDetail>
<wd:LeaveDetail>
<wd:LOA_Start_Date>2018-02-20</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-03-02</wd:LOA_End_Date>
</wd:LeaveDetail>
</wd:LeaveStatus>
<wd:Allocation_Details
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<wd:AllocationInstance>
<wd:Costing_ID/>
<wd:Start_Date/>
<wd:End_Date/>
<wd:Costing_Allocation_Data>
<wd:Allocation_Order/>
<wd:Cost_Center_Allocation/>
<wd:Region_Allocation/>
<wd:Location_Allocation/>
<wd:Distribution_Percentage/>
<wd:Default_from_Organization_Assignment/>
</wd:Costing_Allocation_Data>
</wd:AllocationInstance>
</wd:Allocation_Details>
</wd:Worker_Data>
</wd:Workers>
<wd:ChangeEventSummary>
<wd:ChangeEvent xmlns:xs="http://www.w3.org/2001/XMLSchema">
<wd:EmpID>50211</wd:EmpID>
<wd:TermDate>2018-04-27</wd:TermDate>
<wd:EventDetails> <!--Copied inside this node based on EmpID match-->
<wd:LeaveStatus>
<wd:LeaveDetail>
<wd:LOA_Start_Date>2017-12-22</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-01-22</wd:LOA_End_Date>
</wd:LeaveDetail>
<wd:LeaveDetail>
<wd:LOA_Start_Date>2018-02-20</wd:LOA_Start_Date>
<wd:LOA_End_Date>2018-03-02</wd:LOA_End_Date>
</wd:LeaveDetail>
</wd:LeaveStatus>
</wd:EventDetails>
</wd:ChangeEvent>
</wd:ChangeEventSummary>
</wd:Census_Report>