Hi Team, Currently I'm struggling to split single XML file in multiple XML-files. I need all elements and attributes same as an all xmls, Currently i have mapped single xml to single xml, But requirement is create xslt for single input xml to split to multiple xmls. I want to split xml base on the <RECORD> tag,Could you please support to sort out this concern for your reference here with attached input sample and required output.
Input sample xml- :
<?xml version='1.0' encoding='utf-8'?>
<RECORDS>
<Header>
<MessageId>HAWB XML Export</MessageId>
<SendingDate>2018-10-12 16:39:56</SendingDate>
<JobType>AIR IMPORT</JobType>
</Header>
<RECORD> <!--1st xml -->
<Shipment>
<CargoReadyDate>0000-00-00 00:00:00</CargoReadyDate>
<IncoTerm></IncoTerm>
<NetWeight>1000.000</NetWeight>
<GrossWeight>1050.000</GrossWeight>
<ChargableWeight>1000.000</ChargableWeight>
<Description></Description>
<Remarks>TEST RAMARKS</Remarks>
</Shipment>
<FlightRouteCount>1</FlightRouteCount>
<FROUTES>
<FROUTE>
<FlightCode>CX</FlightCode>
<FlightNo>421</FlightNo>
<FlightDate>2018-10-17</FlightDate>
<FlightTime>11:50:00</FlightTime>
<FlightAPOL>TPE</FlightAPOL>
<FlightAPOD>SYD</FlightAPOD>
</FROUTE>
</FROUTES>
</RECORD>
<RECORD> <!--2nd xml -->
<Shipper>
<ID>225</ID>
</Shipper>
<Consignee>
<ID>225</ID>
</Consignee>
<Shipment>
<CargoReadyDate>0000-00-00 00:00:00</CargoReadyDate>
<IncoTerm></IncoTerm>
<NetWeight>1000.000</NetWeight>
<GrossWeight>1050.000</GrossWeight>
<ChargableWeight>1000.000</ChargableWeight>
<Description></Description>
<Remarks>TEST RAMARKS</Remarks>
</Shipment>
<FlightRouteCount>1</FlightRouteCount>
<FROUTES>
<FROUTE>
<FlightCode>CX</FlightCode>
<FlightNo>421</FlightNo>
<FlightDate>2018-10-17</FlightDate>
<FlightTime>11:50:00</FlightTime>
<FlightAPOL>TPE</FlightAPOL>
<FlightAPOD>SYD</FlightAPOD>
</FROUTE>
</FROUTES>
</RECORD>
<RECORD> <!--3rd xml -->
<Shipper>
<ID>225</ID>
</Shipper>
<Consignee>
<ID>225</ID>
</Consignee>
<Shipment>
CargoReadyDate>0000-00-00 00:00:00</CargoReadyDate>
<IncoTerm></IncoTerm>
<NetWeight>1000.000</NetWeight>
<GrossWeight>1050.000</GrossWeight>
<ChargableWeight>1000.000</ChargableWeight>
<Description></Description>
<Remarks>TEST RAMARKS</Remarks>
</Shipment>
<FlightRouteCount>1</FlightRouteCount>
<FROUTE>
<FlightCode>CX</FlightCode>
<FlightNo>421</FlightNo>
<FlightDate>2018-10-17</FlightDate>
<FlightTime>11:50:00</FlightTime>
<FlightAPOL>TPE</FlightAPOL>
<FlightAPOD>SYD</FlightAPOD>
</FROUTE>
</RECORD>
</RECORDS>
Current Single XSLT- :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/>
<xsl:template match="/">
<UniversalShipment xmlns="http://www.cse.com/Schemas/Universal/2011/11" version="1.1">
<Shipment>
<DataContext>
<DataTargetCollection>
<DataTarget>
<Type>ForwardingShipment</Type>
<Key></Key>
</DataTarget>
</DataTargetCollection>
<Company>
<Code>LK1</Code>
</Company>
<EnterpriseID>EXK</EnterpriseID>
<ServerID>TST</ServerID>
</DataContext>
<ActualChargeable><xsl:value-of select="RECORDS/RECORD/Shipment/ChargableWeight"/></ActualChargeable>
<!--<ActualChargeable>1000.000</ActualChargeable> -->
<AdditionalTerms></AdditionalTerms>
<TransportMode>
<Code>AIR</Code>
<Description></Description>
</TransportMode>
</Shipment>
</UniversalShipment>
</xsl:template>
</xsl:stylesheet>
Expected Sample output- : This is a one xml file i need a generate multiple xmls base on the input xml<RECORD> Tag
<?xml version="1.0" encoding="utf-8"?><UniversalShipment version="1.1" xmlns="http://www.cargowise.com/Schemas/Universal/2011/11">
<Shipment>
<DataContext>
<DataTargetCollection>
<DataTarget>
<Type>ForwardingShipment</Type>
<Key />
</DataTarget>
</DataTargetCollection>
<Company>
<Code>LK1</Code>
</Company>
<EnterpriseID>EXK</EnterpriseID>
<ServerID>TST</ServerID>
</DataContext>
<ActualChargeable>1000.000</ActualChargeable>
<AdditionalTerms />
<TransportMode>
<Code>AIR</Code>
<Description />
</TransportMode>
</Shipment>
</UniversalShipment>