I would like to modify my existing xslt file to get the xml in the output form
Input XML is:
-<NewDataSet>
-<Header>
<BankName>SAMA</BankName>
<CashCenterName>SAMA Riyadh</CashCenterName>
</Header>
-<DepositorList>
<ReferenceNumber>1</ReferenceNumber>
<DepositList_Id>0</DepositList_Id>
<PreparedBy>FZE</PreparedBy>
<TotalContainerCount>2</TotalContainerCount>
<ExpectedDate>2018-04-19T09:13:10-05:00</ExpectedDate>
<DeclaredAmount>150000</DeclaredAmount>
</DepositorList>
-<Carrier>
<CarrierName>tns1:Commercial CIT</CarrierName>
<CarrierNumber>10001</CarrierNumber>
<CarrierLocationName>tns1:Riyadh</CarrierLocationName>
<CarrierLocationNumber>100011</CarrierLocationNumber>
<CarrierLocationRouteName>tns1:R1</CarrierLocationRouteName>
<CarrierLocationRouteNumber>R1</CarrierLocationRouteNumber>
<DepositList_Id>0</DepositList_Id>
</Carrier>
-<ContainerList>
<ContainerNumber>903000033102</ContainerNumber>
<ContainerList_Id>0</ContainerList_Id>
<DeclaredAmount>50000</DeclaredAmount>
<DepositList_Id>0</DepositList_Id>
</ContainerList>
</ContainerList>
-<ContainerContentList>
<ContainerContentList_Id>0</ContainerContentList_Id>
<TotalRecordCount>1</TotalRecordCount>
<ContainerList_Id>0</ContainerList_Id>
</ContainerContentList>
-<ContentCategory>
<ISOCurrencyCode>SAR</ISOCurrencyCode>
<InventoryType>Fit Currency</InventoryType>
<InventorySubType>Fit</InventorySubType>
<ContainerContentList_Id>1</ContainerContentList_Id>
</ContentCategory>
-<ContentCategoryItemList>
<ItemFaceValue>5</ItemFaceValue>
<ItemCount>10000</ItemCount>
<DeclaredAmount>50000</DeclaredAmount>
<ContentCategoryItemList_Id>0</ContentCategoryItemList_Id>
<ContainerContentList_Id>0</ContainerContentList_Id>
</ContentCategoryItemList>
-<CategoryItemUnitList>
<InventoryUnitName>Bundle</InventoryUnitName>
<UnitQuantity>10</UnitQuantity>
<UnitAmount>5000</UnitAmount>
<UnitWeight/>
<MeasurementUnit/>
<BeginSerialNumber/>
<Series/>
<EndSerialNumber/>
<ContentCategoryItemList_Id>0</ContentCategoryItemList_Id>
</CategoryItemUnitList>
Expected Output should be something like this
-<tns:Header>
<tns1:BankName>SAMA</tns1:BankName>
<tns1:CashCenterName>SAMA Riyadh</tns1:CashCenterName>
</tns:Header>
-<tns:DepositList>
<tns1:ReferenceNumber>00000001</tns1:ReferenceNumber>
+<tns1:Carrier>
+<tns1:Customer>
-<tns1:ContainerList>
<tns1:ContainerNumber>903000033102</tns1:ContainerNumber>
-<tns1:ContainerContentList>
-<tns1:ContentCategory>
-<tns1:ContentCategoryItemList>
<tns1:ItemFaceValue>5.0000</tns1:ItemFaceValue>
<tns1:ItemCount>10000</tns1:ItemCount>
<tns1:DeclaredAmount>50000.00</tns1:DeclaredAmount>
-<tns1:CategoryItemUnitList>
<tns1:InventoryUnitName>Bundle</tns1:InventoryUnitName>
<tns1:UnitQuantity>10</tns1:UnitQuantity>
<tns1:UnitAmount>5000.0</tns1:UnitAmount>
<tns1:Series/>
</tns1:CategoryItemUnitList>
</tns1:ContentCategoryItemList>
<tns1:TotalRecordCount>1</tns1:TotalRecordCount>
</tns1:ContainerContentList>
The current xslt is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=".....">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<NewDataSet>
<xsl:copy-of select="NewDataSet/Header"/>
<xsl:for-each select="NewDataSet/DepositorList">
<DepositorList>
<xsl:variable name="DepositList_Id">
<xsl:value-of select="DepositList_Id"/>
</xsl:variable>
<xsl:copy-of select="*"/>
<xsl:copy-of select="../Carrier[DepositList_Id=$DepositList_Id]"/>
<xsl:copy-of select="../Customer[DepositList_Id=$DepositList_Id]"/>
<xsl:copy-of select="../ContainerList[DepositList_Id=$DepositList_Id]"/>
</DepositorList>
</xsl:for-each>
</NewDataSet>
</xsl:template>
</xsl:stylesheet>
Please suggest