Skip to Content

XSLT XML to ABAP with list

hi experts

I am in a rut trying to transform XML to ABAP internal tables and everything is working well except this piece.  I am looking for assistance as everything I am trying is not working.

Here the is XML returned.  Again, I am fine with everything but in the <sources> element.  I have added the things I have tried at the bottom of this thread.  I really appreciate any help on this.



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




















    <country>United States</country>




    <industry>Computer Software</industry>




    <phone>+1 111 111 1111</phone>



    <sicDescription>Services-Prepackaged Software</sicDescription>







My XSLT is again working fine but the <sources> list items are not filling properly.  They way it is now, I get the first item 7 times in the nested internal table.

<xsl:template match="/">
         <xsl:for-each select="company">
               <xsl:value-of select="companyId"/>
               <xsl:value-of select="name"/>
               <xsl:value-of select="companyType"/>
               <xsl:value-of select="companyStatus"/>
               <xsl:value-of select="industry"/>
               <xsl:value-of select="subIndustry"/>
               <xsl:value-of select="street"/>
               <xsl:value-of select="city"/>
               <xsl:value-of select="state"/>
               <xsl:value-of select="zip"/>
               <xsl:value-of select="country"/>
               <xsl:value-of select="phone"/>
               <xsl:value-of select="fax"/>
               <xsl:value-of select="revenue"/>
               <xsl:value-of select="employees"/>
               <xsl:value-of select="subsidiary"/>
               <xsl:value-of select="sic"/>
               <xsl:value-of select="sicDescription"/>
               <xsl:value-of select="naics"/>
               <xsl:value-of select="naicsDescription"/>
               <xsl:value-of select="financialYearEnd"/>
               <xsl:value-of select="equifaxId"/>
               <xsl:value-of select="fortuneRanking"/>
               <xsl:value-of select="description"/>

               <xsl:for-each select="company/sources/source">
                     <xsl:value-of select="source"/>

               <xsl:for-each select="//company/tickers">
                     <xsl:value-of select="exchange"/>
                     <xsl:value-of select="tickerName"/>



when I went to XSLT Tryit Editor v1.0&lt;/title&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/tryit.css&… and tried it there, it didnt work as well.  I tried making  <xsl:for-each select="company/sources/source">  <xsl:for-each select="company/sources"> and all I get is the first item in the list. 

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 15, 2015 at 12:23 AM

    All,I figured it out.

    This is how the sources piece needs to look in order to work.

                   <xsl:for-each select="sources/source">
                         <xsl:value-of select="."/>

    Pretty simple once I figured it out but dont we all say that. 😊

    Add comment
    10|10000 characters needed characters exceeded