ABAP Keyword Documentation → ABAP - Reference → Data Interfaces and Communication Interfaces → ABAP and XML → asXML - Canonical XML Representation → asXML, Examples of Mappings
asXML, Transformation ID vs. Simple Transformation
This example demonstrates the differences between the transformation ID and a Simple Transformation.
Other versions: 7.31 | 7.40 | 7.54
Source Code
DATA: str TYPE string,
xml TYPE string,
len TYPE i.
str = ` `.
len = strlen( str ).
WRITE: / 'String length before:', len.
CALL TRANSFORMATION id SOURCE node = str
RESULT XML xml.
WRITE / xml.
CALL TRANSFORMATION id SOURCE XML xml
RESULT node = str.
len = strlen( str ).
WRITE: / 'String length after: ', len.
SKIP.
str = ` `.
len = strlen( str ).
WRITE: / 'String length before:', len.
CALL TRANSFORMATION demo_asxml_copy SOURCE root = str
RESULT XML xml.
WRITE / xml.
CALL TRANSFORMATION demo_asxml_copy SOURCE XML xml
RESULT root = str.
len = strlen( str ).
WRITE: / 'String length after: ', len.
Description
A text string with five blanks is serialized and deserialized to a
Simple Transformation DEMO_ASXML_COPY using the predefined
identity transformation ID and the statement
tt:copy. The transformation
ID contains the statement <xsl:strip-space elements="*"/>
, which means
that the blanks are ignored by the deserialization and the text string then has the length 0. After the deserialization by the Simple Transformation, the blanks are present in the text string.