05-11-2006 1:23 PM
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.
05-11-2006 6: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' ?>
<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