Skip to Content
avatar image
Former Member

Help Required on XSLT Mapping

Hi Folks,

    I need some help on XSLT mapping as I am very new to it. I have attached a source and target  file. I need inputs on XSLT mapping in order to achieve the Target message from the Source.

Source

xml version="1.0" encoding="UTF-8"?>

ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

  <ns0:Message1>

    <ns1:PayloadDescriptor xmlns:ns1="http://Softel.com/xi/Softel_SC_PLANNING/GPEO/TransactionalData">

      <MessageFormat>owner=&quot;Softel&quot;;version=1.0;date=&quot;October 2013&quot;;</MessageFormat>

      <SenderId>Softel-GPEO</SenderId><RecipientId>SoftelCorp</RecipientId>

      <ControlNumber>0000000001</ControlNumber>

      <MessageId>A123-B123-C123-D123</MessageId>

      <DocumentType>SoftelOrders</DocumentType>

      <DateSent format="yyMMDDhhmmss" timezone="UTC">20140117000001</DateSent>

      <PayloadType>Text/Plain</PayloadType>

      <Version>1.0</Version>

    </ns1:PayloadDescriptor>

</ns0:Message1>

<ns0:Message2>

    <AttachmentDescriptor>

       <DocumentType>SoftelOrders</DocumentType>

       <Version>1.0</Version>

       <Date format="yyMMDDhhmmss" timezone="UTC">20140117000001</Date>

       <Attachments count="">

          <Attachment>

            <FileData>

              <Include href="A123-B123-C123-D123">

              </Include>

            </FileData>

            <FileName>Sample.txt</FileName>

            <FileType>Text</FileType>

            <FileCreateDate format="yyMMDDhhmmss" timezone="UTC">20140117000001</FileCreateDate>

           <FileSize uom="byte">100</FileSize></Attachment>

         </Attachments>

      </AttachmentDescriptor>

</ns0:Message2>

</ns0:Messages>

Target Message

<?xml version="1.0" encoding="UTF-8"?>

<ns0:stylesheet version="1.0" xmlns:ns0="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://Softel.com/xi/Softel_SC_PLANNING/GPEO/TransactionalData">

   <ns0:template match="/">

      <ns1:Envelope xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

         <ns1:Header>

            <PayloadDescriptor>

               <MessageFormat>&quot;Softel&quot;;version=1.0;date=&quot;October 2013&quot;;</MessageFormat>

               <SenderId>Softel-GPEO</SenderId>

               <RecipientId>SoftelCORP</RecipientId>

               <ControlNumber>0000000001</ControlNumber>

               <MessageId>A123-B123-C123-D123</MessageId>

               <DocumentType>SoftelOrders</DocumentType>

               <DateSent format="yyMMDDhhmmss" timezone="UTC">20140117000001</DateSent>

               <PayloadType>Text</PayloadType>

               <Version>1.0</Version>

            </PayloadDescriptor>

         </ns1:Header>

         <ns1:Body>

            <AttachmentDescriptor>

               <DocumentType desc="" valueDesc="">SoftelOrders</DocumentType>

               <Version desc="" valueDesc="">1.0</Version>

               <Date desc="" valueDesc="" format="" timezone="">20140117000001</Date>

               <Attachments count="1">

                  <Attachment>

                     <FileData>

                        <Include href="A123-B123-C123-D123"/>

                     </FileData>

                     <FileName>Sample.txt</FileName>

                     <FileType desc="" valueDesc="">Text</FileType>

                     <FileCreateDate desc="" valueDesc="" format="" timezone="">20140117000001</FileCreateDate>

                     <FileSize desc="" valueDesc="" uom="byte">100</FileSize>

                  </Attachment>

               </Attachments>

            </AttachmentDescriptor>

         </ns1:Body>

      </ns1:Envelope>

   </ns0:template>

</ns0:stylesheet>

Target_File.xml (2.1 kB)
Source_File.Xml (1.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 17, 2014 at 08:35 PM

    Hello,

    I don't see much complexity in ur XSLT, u are just creating soap envelope and populating header and body.

    Share ur XSLT draft which u have written? In case u haven't started doing it till yet, then i would suggest you to refer below article and start writing it and post ur questions in case of any errors.

    XSLT Mapping in SAP PI 7.1

    Thanks

    Amit Srivastava

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17, 2014 at 08:07 PM

    Hi Santosh,

    Why you want to do the transformation in XSLT? Is there any special req.?

    regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded