Start of Content Area

Syntax documentation Literal Text  Locate the document in its SAP Library structure

Every content of a template that is not an element (which means that it is not positioned between < >), is literal text. This includes line feeds and blanks, which are combined under the term whitespace. In ST programs, literal text can additionally be identified using the ST command tt:text.

Literal Text Without Identification:

 

...>text<...

 

Literal Text With Identification:

 

...><tt:text>text</tt:text><...

 

The difference between these variants is that an unidentified text text is not considered during serialization and deserialization if it contains nothing but whitespace. An identified text is always considered.

 

Serializing Literal Text

If a literal text is considered, then all its characters are written to the target XML document. This includes any whitespace. For an unconsidered text, nothing is transferred.

 

Deserializing Literal Text

The literal text of the XML source document is compared character by character (including blanks and line feeds) to the ST program and consumed. This means that at every position in the inbound stream, at which there is literal text, the same text must appear in the ST program and must also be considered there.

 

Note

Use literal texts with other characters except whitespace sparingly, always identify them with tt:text and do not extend them over several lines because line feeds and indents are potential error sources during deserialization. Use unidentified texts only to format the ST program with line feeds and blanks (indents). To avoid problems during deserialization of literal texts, you can skip them using tt:skip.

 

Example

The ST program below contains four elements X1 to X4 with literal text.

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:template>
    <X1> a b c </X1>
    <X2><tt:text> d e f </tt:text></X2>
    <X3>     </X3>
    <X4><tt:text>     </tt:text></X4>
  </tt:template>

</tt:transform>

 

The result of a serialization is as follows, where the blanks in X3 are not considered:

 

<X1> a b c </X1><X2> c d e </X2><X3/><X4>     </X4>

 

This XML document can itself be deserialized again by the above ST program. The ST program below triggers the exception CX_ST_MATCH_ELEMENT, because for the blanks in the inbound stream within X4 no blanks exist in the ST program, due to the missing identification with tt:text.

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:template>
    <X1>a b c</X1>
    <X2><tt:text>d e f</tt:text></X2>
    <X3>     </X3>
    <X4>     </X4>
  </tt:template>

</tt:transform>

 

Neither can the ST program below deserialize the XML document, because it expects line feeds in X1 and more blanks due to the indent.

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:template>
    <X1>
      a b c
    </X1>
    <X2><tt:text>d e f</tt:text></X2>
    <X3>     </X3>
    <X4>     </X4>
  </tt:template>

</tt:transform>

 

The ST program below can deserialize the XML document; all elements are skipped with tt:skip.

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:template>
    <X1><tt:skip /></X1>
    <X2><tt:skip /></X2>
    <X3><tt:skip /></X3>
    <X4><tt:skip /></X4>
  </tt:template>
</tt:transform>

 

 

 

 

 

End of Content Area