Hi All,
This question may sound out of forum. But I am having one BSP application which takes XML file as a input and transforms into another XML using a XSLT (using SAP XSLT processor). I have used call transformation method for the same which is working fine (i.e.its transforming correctly).
I noticed that the target system accepts XML file only with encoding 16 and the source file comes with encoding ISO.Is anyone aware of setting encoding in XSLT ? I tried to use but I guess SAP XSLT processor does'nt support that.
Thanks in advance.
Rajeev
Hi,
the XSLT processor does support xsl:output/@encoding, but refuses to write anything but the system codepage into a STRING. You're able to choose another encoding if you write into an XSTRING.
Instead of using xsl:output, you may also supply an iXML output stream (IF_IXML_OSTREAM) as the transformation result and set an encoding on the stream.
Regards - Karsten
I don't know if it would work or not but you could have the XSLT processor render its output into a string data type. You could then use the following code to cast to UTF-16 byte string and add the Byte Order Mark.
data: lapp_type type char30. ****Set the application Type - character set for conversion from string to ****Binary String - Excel Requires UTF-16 with Little Endian lapp_type = 'text/unicode; charset=utf-16le'. ****Convert the string to Binary string (UTF-16le) call function 'SCMS_STRING_TO_XSTRING' exporting text = r_string mimetype = lapp_type importing buffer = r_xstring. ****Add the UTF-16 Little Endian Byte Order Mark to the begining of the file concatenate cl_abap_char_utilities=>byte_order_mark_little r_xstring into r_xstring in byte mode.
Add a comment