Skip to Content
avatar image
Former Member

XSLT - XML

Hi friends

I have to read an XML file from the aplication server in data object inside abap program throught XSLT. Someone can help me?

Best Regards.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 11, 2006 at 05:21 PM

    Hello Pedro,

    You can call abap class / method inside XSLT to get expected result.

    I have pasted some sample code..pls. modify as per your reuirement. It is xslt code....

    • This XSLT mapping is used to wrap the payload with the canonical. The corelation ID is generated.

    <?xml version='1.0' ?>

    http://www.w3.org/1999/XSL/Transform"

    xmlns:p2="urn:com.nl4b.sdn.weblog:abapxsltmapping"

    xmlns:sap="http://www.sap.com/sapxsl"

    xmlns:sdn="http://sdn.sap.com/sapxsl">

    <xsl:output method="xml" encoding="UTF-8"/>

    <sap:external-function class="ZCL_GET_NEXT_NUMBER"

    kind="class"

    method="GET_NEXT_NUMBER"

    name="sdn:GetNextNo">

    <sap:result param = "O_NUMBER" type="string"/>

    </sap:external-function>

    <xsl:template match="/">

    <cnclErpDocument>

    <header>

    <originatingDocType/>

    <originatingDocTypeVersion/>

    <creationTime/>

    <context>

    <correlationId>

    <xsl:value-of select="sdn:GetNextNo()"/>

    </correlationId>

    <importance/>

    <userInformation/>

    <source/>

    <target/>

    </context>

    </header>

    <body>

    <payload>

    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>

    <xsl:copy-of select="/*"/>

    <xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>

    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>

    </payload>

    </body>

    </cnclErpDocument>

    </xsl:template>

    </xsl:stylesheet>

    where "ZCL_GET_NEXT_NUMBER" is abap class and "GET_NEXT_NUMBER" is method.

    PS : Award points if you find it helpful.

    Cheers,

    Nilesh

    Add comment
    10|10000 characters needed characters exceeded