If Statements
If statements enable you to specify a condition, and if the condition is met, then the specified mapping is output.
When you chose this option, an If statement appears before the selected element, and you must place an XPath expression in the If statement that evaluates to a boolean. If the expression evaluates to true, the specified mapping is performed. If the expression evaluates to false, the mapping is not performed and no value is set for the item. Do not place an If statement around schema data components that are marked as required.
In this example, the returnDate schema element is optional. The returnDate element is surrounded by an If statement that evaluates whether the roundTrip element is true. If roundTrip is true, then the element is output, if roundTirp is false, the returnDate element is not output. The expression in the If statement is:
string($MessageData/ns:searchAirlineRequest/ns:parameters/ns0:searchAirline/roundTrip) = "true"