I have two XML files i am trying to merge some elements using xsl.
XML1:
<ALL xmlns:a="http://example.com/ns1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<a:BusinessUnit>
<a:businessUnitCode>SGS</a:businessUnitCode>
<a:longName>Singapore Global Sourcing</a:longName>
<a:parentBusinessUnitCode>CGS</a:parentBusinessUnitCode>
</a:BusinessUnit>
<a:BusinessUnit>
<a:businessUnitCode>EGH</a:businessUnitCode>
<a:longName>EMS Global HQ</a:longName>
<a:parentBusinessUnitCode xsi:nil="true"/>
</a:BusinessUnit>
XML2:
<Get_ProductFamily xmlns:aa="http://example.com/ns2">
<aa:ProductFamily>
<aa:integrationId>2323</aa:integrationId>
<aa:parentBusinessUnitCode>EGH</aa:parentBusinessUnitCode>
</aa:ProductFamily>
<aa:ProductFamily>
<aa:integrationId>3434</aa:integrationId>
<aa:parentBusinessUnitCode>CGS</aa:parentBusinessUnitCode>
</aa:ProductFamily>
<aa:ProductFamily>
<aa:integrationId>4545</aa:integrationId>
<aa:parentBusinessUnitCode>CDD</aa:parentBusinessUnitCode>
</aa:ProductFamily>
</Get_ProductFamily>
output:
<GroupList>
<Group>
<Name>EGH - EMS Global HQ</Name>
<ProductLineList>
<ProductLine>
<Name>EGH</Name>
<CODE>2323</CODE>
</ProductLine>
</ProductLineList>
</Group>
<GroupList>
I want to Read Business unit data from 1st file and product family data from 2nd file and generate group info.
Steps are: Read all business unit
Group name is concatenation of a:businessUnitCode and a:longName (I did this part)
when a:parentBusinessUnitCode is blank, then read its a:businessUnitCode, search this businessUnitCode in 2nd file.
if a:businessUnitCode(1st file) is equal to aa:parentBusinessUnitCode (2nd file) then print its integration id.
Please help me as i am new to xsl.