Skip to Content
avatar image
Former Member

graphical mapping

Hi friends,

we have curently following requirement. Maybe you can help me.

The input message is like below;

   <root>

     <person>

         <name>martin</name>

         <date>01012012</date>

     </person>

     <licence>

         <class>A</class>

         <country>Germany</country>

     </licence>

     <model>

         <class>A</class>

         <type>Volkswagen</type>

     </model>

 

     <person>

         <name>Juan</name>

         <date>02012012</date>

     </person>

     <licence>

         <class>B</class>

         <country>Italy</country>

     </licence>

     <model>

         <class>B</class>

         <type>FIAT</type>

     </model>

</root>

My needed output message is;

<root>

     <person>

         <name>martin</name>

         <date>01012012</date>

           <licence>

             <class>A</class>

             <country>Germany</country>

         </licence>

         <model>

             <class>A</class>

             <type>Volkswagen</type>

         </model>

     </person>

     <person>

         <name>Juan</name>

         <date>02012012</date>

         <licence>

             <class>B</class>

             <country>Italy</country>

         </licence>

         <model>

             <class>B</class>

             <type>FIAT</type>

         </model>

     </person>

</root>

How can i solve the problem?

Kind Regards,

PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jul 18, 2012 at 06:38 AM

    Hi Peter,

    Can you confirm if your input message given above has only one <root> segment?

    Or is it going to be two?

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 18, 2012 at 07:35 AM

    Hi,

    Try the following XSLT mapping:

    <xsl:template match="/">

    <xsl:for-each select="root/person">

      <person>

        <name><xsl:value-of select="name"/></name>

        <date><xsl:value-of select="date"/></date>

        <licence>

          <class><xsl:value-of select="following-sibling::licence/class[1]"/></class>

          <country><xsl:value-of select="following-sibling::licence/country[1]"/></country>

        </licence>

        <model>

          <class><xsl:value-of select="following-sibling::model/class[1]"/></class>

          <type><xsl:value-of select="following-sibling::model/type[1]"/></type>

        </model>

      </person>

    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

    Regards,

    Greg

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 18, 2012 at 01:00 PM

    hi,

    the structure and occurences are as below:

    Mapping is one to one mapping:

    the test iresult is as below.

    i  hope this meets u r requirement😊. dont forget to award points

    venu ravipati

    Add comment
    10|10000 characters needed characters exceeded