Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XSLT - XML

Former Member
0 Likes
363

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.

1 REPLY 1
Read only

Former Member
0 Likes
297

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' ?>

<xsl:stylesheet version="1.0" xmlns:xsl="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