2015 Apr 29 2:49 AM
Hi,
Is there anyway to generate dynamic XSLT source code based upon final structure of output internal table and call dynamic generated XSLT in program?
CALL TRANSFORMATION z_transformation
PARAMETERS
p_shared_string = lo_shared_str_nodeset
SOURCE XML g_sheet_data
RESULT lt_data = i_data[].
Source code example of XSLT transformation -
<xsl:template match="/">
<asx:abap version="1.0">
<asx:values>
<LT_DATA> "Internal table
<xsl:for-each select="ss:worksheet/ss:sheetData/ss:row">
<xsl:if test="position() > 1">
<item>
<FIELD1>
<xsl:variable name="cell_id" select="concat('A', position())"/>
<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>
<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</FIELD1>
</item>
</xsl:if>
</xsl:for-each>
</LT_DATA> "internal table
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
2015 Apr 29 3:10 AM
In addition,
We are converting binary data of excel from application server into internal table but currently we created two XSLT transformation to achieve this one for deleting name space and other for converting data into internal table format.
We want to make our source code for future use also,Is there anyway to generate XSLT source code dynamically?Above mentioned code is snippet of data extracting which we are doing but this transformation is hard coded.
Any help is appreciated.
BR,
Praveen
2015 Aug 07 7:35 AM