Using a Literal to Populate Target Elements

You can add a Literal node, enter the literal value, and link the Literal node to one or more targets. This hard codes the literal value into the target.

Alternately, you can use a constant to populate a target inside a transformation expression by creating a map link, clicking the map link, adding a constant to the Transformation Rule Expression canvas, and then wiring the constant to the target.

To add a literal:

  1. Double-click to expand a target schema node.

  2. Right-click in the Map canvas and choose Add Literal.

  3. Click the Literal (literal_n) node to edit the Literal Properties in the Properties Panel view.

    Literal properties

    FieldExplanation and options
    NameAutomatically named literal_n. Edit as necessary.
    Literal ValueEnter any string or constant to be assigned to the target, for example, -256.125.
  4. To link the Literal to a target, click the Literal node's connection point, which is either a yellow or green dot, then click directly on the target name, for example, Month12 [xsd:integer]. Repeat for each target that receives the literal value.

    A map link, which is a blue arrow, is created and connects the Literal to the target.

  5. Click the Literal map link to edit the Link properties in the Properties Panel view:

    Link properties

    FieldExplanation and options
    Source literalDisplays the name of the literal node, for example, literal_4, as defined earlier in Literal properties.
    Target full path Displays a string identifying the target schema, element, and attribute (optional), for example, /sy2:OrderSummary/sy2:OrderRef.
    Path fieldExplanation

    sy2

    An arbitrary namespace identifier.

    OrderSummary

    The name of the schema's root node.

    OrderRef

    The target, in this case, an element.
    Target relative path

    Displays a string identifying the target without the schema qualifier, for example, ../ParallelAttributeInSameElement.

    Output as CDATA Character Data (CDATA) defeats the standard XML encoding rules for & (ampersand), > (greater than), and ... (ellipsis), allowing the literal data to bypass the XML parser.

    Select Yes to encode the literal inside a CDATA section. That is, the literal is wrapped between the delimiters <![CDATA[ and ]]>.

    Test Enter the test condition that defines the condition on which the target is created.

    For example, /sy2:OrderSummary/Sy2:OrderRef!=" checks the presence of input values during runtime and omits the target in the resulting XML document if Sy2:OrderRef is empty (null).

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com