cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT: XML with namespace to ABAP itab

Former Member
0 Kudos

Hi!

I'm having troubles transforming a XML file to an internal table.

The transformation used to work fine, but the customer added a namespace to the document and now the transformation does not work anymore.

Any help is highly appreciated!

Here is an example of the new XML document with namespace. (line with ns0:GOODS)

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

<ns0:GOODS xmlns:ns0="http://schemas.obis.com/e-commerce/goods">

<payout_report merchant="OBIS" period_id="90081520">

<period>

<begin_date>2008/01/01</begin_date>

<end_date>2008/06/07</end_date>

</period>

<payout_payment id="99399639">

<merchant_reference>00000000000000102636</merchant_reference>

<payment_id>157279974</payment_id>

<type>paid</type>

<mutation_date>2007/12/23 16:08</mutation_date>

<amount_registered amount="88.050" currency="EUR" />

<amount_collected amount="88.050" currency="EUR" />

<tpcd amount="0.000" currency="EUR" />

<tpci amount="1.937" currency="EUR" />

</payout_payment>

</payout_report>

</ns0:GOODS>

And here is the XSLT program:

<xsl:transform version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:strip-space elements="*"/>

<xsl:template match="/">

<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">

<asx:values>

<ITAB>

<xsl:for-each select="payout_report">

<xsl:variable name="pay_rep" select="."/>

<xsl:variable name="boekdatum" select="period/end_date"/>

<xsl:for-each select="payout_payment">

<xsl:variable name="pay_pay" select="."/>

<PAYMENT>

<BOEKDATUM ><xsl:value-of select="$boekdatum"/></BOEKDATUM>

</PAYMENT>

</xsl:for-each>

</xsl:for-each>

</ITAB>

</asx:values>

</asx:abap>

</xsl:template>

</xsl:transform>

Edited by: Sebastian Fletterman on Jun 26, 2008 2:50 PM

Edited by: Sebastian Fletterman on Jun 26, 2008 3:11 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi try this

<xsl:transform version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://schemas.obis.com/e-commerce/goods">

<xsl:strip-space elements="*"/>

<xsl:template match="ns0:GOODS">

<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">

<asx:values>

<ITAB>

<xsl:for-each select="payout_report">

<xsl:variable name="pay_rep" select="."/>

<xsl:variable name="boekdatum" select="period/end_date"/>

<xsl:for-each select="payout_payment">

<xsl:variable name="pay_pay" select="."/>

<PAYMENT>

<BOEKDATUM ><xsl:value-of select="$boekdatum"/></BOEKDATUM>

</PAYMENT>

</xsl:for-each>

</xsl:for-each>

</ITAB>

</asx:values>

</asx:abap>

</xsl:template>

</xsl:transform>

Sameer

Former Member
0 Kudos

Hi Sameer,

Great, this completely did the job!

Many thanx and best regards,

Sebastian

Answers (0)