Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to Map XML's when Input xml not does not have exact Name space

$
0
0

Hi Team,

Currently i have a requirement to write xslt map to transform one xml format to another format, according to when i trying to map the xml's on the xslt, noticed input xml does not have a exact namespace, Due to the reason i'm still not able to write namespace mapping, According to Could you please support to create header mapping, for yo

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>

<Consignee>
<ID>162</ID>
<Name>North TECH CO.,LTD</Name>
<Address>CENTER POWER PARK</Address>
  <Contact>
  <Name></Name>
  <Email></Email>
  <Tel></Tel>
  </Contact>
</Consignee>
<Shipment>
<CargoReadyDate>0000-00-00 00:00:00</CargoReadyDate>
<CargoHandOverDate>0000-00-00</CargoHandOverDate>
<JobType>Direct</JobType>
<AgentID></AgentID>
<Airline>
<ID>65</ID>
<Name>AIR ASIA</Name>
</Airline>
<FlightNo>AU745</FlightNo>
<APOL>SYD</APOL>

</Shipment>
<FlightRouteCount>2</FlightRouteCount>
<FROUTES>

<FROUTE>
<FlightCode>CX</FlightCode>
<FlightNo>611</FlightNo>
<FlightDate>2018-10-17</FlightDate>
<FlightTime>20:15:00</FlightTime>
<FlightAPOL>SYD</FlightAPOL>
<FlightAPOD>CMB</FlightAPOD>
</FROUTE>
</FROUTES>
</RECORD>

</RECORDS>


Current Namespace mapping-:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0= 

<xsl:template match="/">

Output:-

     

<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>1000.000</ActualChargeable>
    <AdditionalTerms></AdditionalTerms>

etc...........


Viewing all articles
Browse latest Browse all 935

Trending Articles