Setting the value of an output element with a explicit data type

In the Graphical Data Mapping editor, you can use any of the xs:type transforms to cast the value of a simple type input element and set the value of a simple type output element.

About this task

For example, you want to assign a value with a specific data type to a target element that is defined as xs:anySimpleType. You can use the xs:type transform.

You can have zero or more input elements to an xs:type transform. However, you can only cast one value for an output element by using an xs:type transform. If the mapping for the xs:type transform has more than one input, any input that is not referenced by the argument of the xs:type transform will be ignored.

You can use the input elements to build a conditional expression that determines if the xs:type transform is applied or not.

You must choose the xs:type transform according to the output element data type. For example, if you have an output element with a boolean data type, you must choose xs:boolean transform.

You can use any of the following xs:any transforms:
  • xs:NOTATION: This function takes a primitive and casts it as notation.
  • xs:Qname: This function takes a primitive and casts it as Qname.
  • xs:anyURI: This function takes a primitive and casts it as anyURI.
  • xs:base64Binary: This function takes a primitive and casts it as base64Binary.
  • xs:boolean: This function takes a primitive and casts it as boolean.

    You can use any of the following values: true or false.

  • xs:dateTime: This function takes a primitive and casts it as dateTime.
  • xs:date: This function takes a primitive and casts it as date.
  • xs:dayTimeDuration: This function takes a primitive and casts it as dayTimeduration.
  • xs:decimal: This function takes a primitive and casts it as decimal.
  • xs:double: This function takes a primitive and casts it as double.
  • xs:float: This function takes a primitive and casts it as float.
  • xs:gDay: This function takes a primitive and casts it as gDay.
  • xs:gMonthDay: This function takes a primitive and casts it as gMonthDay.
  • xs:gMonth: This function takes a primitive and casts it as gMonth.
  • xs:gYearMonth: This function takes a primitive and casts it as gYearMonth.
  • xs:gYear: This function takes a primitive and casts it as gYear.
  • xs:hexBinary: This function takes a primitive and casts it as hexBinary.
  • xs:integer: This function takes a primitive and casts it as integer.
  • xs:int: This function takes a primitive and casts it as signed 32-bit integer.
  • xs:string: This function takes a primitive and casts it as string.
  • xs:time: This function takes a primitive and casts it as time.
  • xs:yearMonthDuration: This function takes a primitive and casts it as yearMonthDuration.

Procedure

Complete the following steps to set the value of a output element by using an xs:type transform:

  1. Add an xs:type transform, for example, an xs:boolean transform, to set the value of the output element, by using either of the following methods:
    1. Create an Assign transform by using either of the following methods:
      • Click the output element and drag the connector towards the input elements, releasing the connector onto a blank part of the canvas. When you release the connector, an Assign transform is created.
      • Right-click the output element and then select Create Assign.
    2. Use the drop-down, and select Cast Function > xs:boolean.
  2. Enter true into the Value field in the Properties panel for the xs:boolean transform.

    You can set the value to true or false.

    xs:boolean transform that returns true

  3. Optional: Define a conditional expression to control when the transform should be applied .

    You define a conditional expression by using an XPath expression.

    For example, to evaluate the transform, the current date has to be a date after the date specified in the element CurrentDate.

    Shows the conditional expression $CurrentDate > fn:current-date().