Start of Content Area

Syntax documentation Addressing the Current Node  Locate the document in its SAP Library structure

In all ST commands in which the name of a node can be specified, the current node can be addressed explicitly with $ref. An alias name can also be defined for $ref in tt:loop commands that transform internal tables. If specification of the node is optional, ST commands use the current node by default.

Note

If the current node is undefined, is cannot be addressed with $ref, and ST commands that implicitly use the current node cannot be executed.

 

Example

The following ST program can be used to serialize a nested ABAP structure:

 

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

<tt:root name="ROOT"/>

  <tt:template>
    <X tt:ref="ROOT">
      <X1 tt:ref="$ref.COL1">
        <tt:value ref="$ref" />
      </X1>
      <X2 tt:ref="$ref.COL2">
        <tt:value ref="$ref" />
      </X2>
      <X3 tt:ref="STRUC2">
        <X1 tt:ref="COL1">
          <tt:value />
        </X1>
        <X2 tt:ref="COL2">
          <tt:value />
        </X2>
      </X3>
    </X>
  </tt:template>

</tt:transform>

 

In the example, subnodes COL1 and COL2 are set as the current node in the surrounding elements of the tt:value commands with ROOT and STRUC2, respectively. In the first two elements, the current node is addressed explicitly using $ref for demonstration purposes. The current node is also specified using $refin the first two tt:value commands, while specification is implicit in the other two tt:value commands.

Also see the example for calling a transformation in the Structures section.

 

 

End of Content Area