5 Replies Latest reply: Nov 1, 2012 9:13 AM by Tarak RSS

    XSL Transformation

    user12304177
      Hi ,

      i am new to soa 11g bpel, could you please help me in the below scenario.

      I need to exchange source xml data to different target xml format. Source xml element is unbound and contains order header fields like orderId , customerId and item data like itemId ,orderId, qty which is also unbound. i need to prepare target xml data for each item that should contain fields like orderId, customerId, itemId,qty.

      for example if the source xml is having 2 records for each one having 3 items then i should prepare (2x3 =6 ) 6 target records.

      please help me

      thanks and regards
      Guru...
        • 1. Re: XSL Transformation
          vladodias
          Hi Guru,

          Please post an example of your input xml and your expected output and I can help you out with the transformation.

          Cheers,
          Vlad
          • 2. Re: XSL Transformation
            user12304177
            Hi ,

            Thanks for your reply,

            source xml,

            <?xml version="1.0" encoding="windows-1252" ?>
            <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified">
            <xsd:element name="orderHeaderEle">
            <xsd:annotation>

            </xsd:annotation>
            <xsd:complexType>
            <xsd:sequence>
            <xsd:element name="orderHeader" type="OrderHeaderT"
            maxOccurs="unbounded">

            </xsd:element>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:element>

            <xsd:complexType name="OrderLineT">
            <xsd:sequence>
            <xsd:element name="orderId" type="xsd:string"/>
            <xsd:element name="itemId" type="xsd:string"/>
            <xsd:element name="qty" type="xsd:string"/>
            </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="OrderHeaderT">
            <xsd:sequence>
            <xsd:element name="orderId" type="xsd:string"/>
            <xsd:element name="custId" type="xsd:string"/>
            <xsd:element name="orderLineEle">
            <xsd:complexType>
            <xsd:sequence>
            <xsd:element name="orderLine" type="OrderLineT"
            maxOccurs="unbounded"/>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:element>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:schema>


            target xml,

            <?xml version="1.0" encoding="windows-1252" ?>
            <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified">
            <xsd:element name="taskEle">
            <xsd:complexType>
            <xsd:sequence>
            <xsd:element name="task" type="taskT" maxOccurs="unbounded"/>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:element>
            <xsd:complexType name="taskT">
            <xsd:sequence>
            <xsd:element name="custId" type="xsd:string"/>
            <xsd:element name="orderId" type="xsd:string"/>
            <xsd:element name="itemId" type="xsd:string"/>
            <xsd:element name="qty" type="xsd:string"/>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:schema>
            • 3. Re: XSL Transformation
              Tarak
              Hi Guru,

              Here is you the XSLT code for your requirement.

              <ns1:taskEle>
              <xsl:for-each select="/ns1:orderHeaderEle/ns1:orderHeader">
              <xsl:for-each select="ns1:orderLineEle/ns1:orderLine">
              <ns1:task>
              <ns1:custId>
              <xsl:value-of select="../../ns1:custId"/>
              </ns1:custId>
              <ns1:orderId>
              <xsl:value-of select="ns1:orderId"/>
              </ns1:orderId>
              <ns1:itemId>
              <xsl:value-of select="ns1:itemId"/>
              </ns1:itemId>
              <ns1:qty>
              <xsl:value-of select="ns1:qty"/>
              </ns1:qty>
              </ns1:task>
              </xsl:for-each>
              </xsl:for-each>
              </ns1:taskEle>

              This will give the result what you expecting. To under more about the xslt look into http://www.w3schools.com/xsl/default.asp

              Regards,
              Tarak.
              • 4. Re: XSL Transformation
                user12304177
                thanks for your reply.

                can you please tell me what is the SDO/DOM variables in SOA 11g context.

                Edited by: Guru_user12304177 on Oct 27, 2012 12:12 AM
                • 5. Re: XSL Transformation
                  Tarak
                  Hi ,

                  Please raise this as a separate thread. The idea is to have separate thread for each problem. So that it will be easy for people who are looking for solutions.
                  So please keep it in a separate thread. I will catch u next thread.

                  Regards,
                  Tarak..