Linking a Source to a Target

Define the transformation service implementation by wiring sources to targets. All sources and targets must first be defined as operation parameters. After you link a source to one or more targets, you can set transformations on the links.

To link a source to a target:

  1. On the Map canvas, select both a source content model and a target content model.

    Both nodes open and display elements and attributes.

  2. In the source schema, navigate to the source from which you want to link.

  3. Drag the source, for example, OrderRef [xsd:float], and drop it onto the target, for example, OrderRefTarget[xsd:string].

    A link, which appears as a blue arrow, connects the two schemas.

    • For some functions, such as concatenate or substring, you must map two or more sources to the same target. The first link is solid, indicating it is for operand 1. Additional sources are linked with a dashed line, indicating operand 2, 3, and so on.

    • When mapping more than one source element to a single target element, the default operation will be determined based on the data type of the target element.

      If the data type of the Target element isThe default operation is

      numeric

      add

      boolean

      equal to

      all other mappings of multiple source elements to a single target element

      concat

    You can change the default operation to the operation appropriate for your implementation as needed.

  4. Ensure no mandatory targets remain unmapped.

    If a mandatory target is not wrapped, you receive warnings in the Problems view and runtime errors.

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

    Link properties

    FieldDescription and options
    Source full path Displays a string identifying the target schema, element, and attribute (optional), for example,

    /Sy2:OrderSummary/Sy2:OrderRef

    Path fieldExplanation

    Sy2

    An arbitrary identifier.

    OrderSummary

    The name of the schema's root node.

    OrderRef

    The target, in this case, an element.

    Source relative path Displays a string identifying the target without the schema qualifier, for example,

    ../ParallelAttributeInSameElement

    Target full path Displays a string identifying the target schema, element, and attribute (optional), for example,

    /Sy2:OrderSummary/Sy2:OrderRefTarget

    Path fieldExplanation

    Sy2

    An arbitrary identifier.

    OrderSummary

    The name of the schema's root node.

    OrderRefTarget

    The target, in this case, an element.

    Target relative path Displays a string identifying the target without the schema qualifier, for example, ../ParallelAttributeInSameElement.
    Mapping Mode Select a mapping mode. The mapping mode defines two properties of transformation logic:

    • Whether a source is copied completely or value only.

    • Whether a repeating source is copied once or for each iteration.

    Mapping mode

    Explanation of logic

    for-each Loops through each instance of the source node and creates an instance of the target for each source.

    This mapping mode is assigned by default when linking to non-terminal elements, regardless of whether the target is a repeating element.

    value-of Copies the value of the source node to the target node. You can also define a rule that transforms the source value as it is copied to the target.

    This mapping mode is assigned by default when linking to terminal elements or attributes.

    copy-of Performs a deep copy of the source element when creating the target element. The source element contains a deep structure of elements and attributes, which is copied to the target element.

    This mapping mode is never assigned by default.

    for-each-value-of Loops through each instance of the source element and for each loop, copies its value to the target element.

    This mode is assigned as the default when the target element is terminal and repeating or when the target element is terminal and contains attributes.

    Note

    When this mode is used, the properties on the link contain an additional property called ForEach Select, with a value referring back to the name of the source element This property creates the context over which the values of each instance are copied.

    If you define a rule to transform the source value as it is copied to the target, the XPath "." appears in the generated XSLT. This indicates the current node because it is relative to the node selected by the ForEach Select property.

    Output as CDATA

    The Character Data (CDATA) tag is used to escape blocks of text containing characters that would otherwise be recognized as markup. For example: & (ampersand), < (less than), > (greater than).

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

    Test

    (Repeating or optional target elements only) 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).

    Browse for template

    Select a user-defined xsl: template. See Mapping with User-Defined XSLT Templates.

  6. Save the service. Select File|Save in the menu bar.

To undo a link:

Right-click anywhere on the Map canvas and select Undo Add Connection from the context menu.

This deletes the last link you added.

Next: Defining a Transformation Rule on a Map Link

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