XSLT

Use the XSLT policy to apply an XSLT transform to the payload of the API definition.

Gateway support

Table 1. Table showing which gateways support this policy, and the corresponding policy version
Gateway Policy version
DataPower® Gateway (v5 compatible) 1.0.0
DataPower API Gateway, policy available from V2018.4.1.0 2.0.0

This topic describes how to configure the policy in the assembly user interface; for details on how to configure the policy in your OpenAPI source, see xslt.

About

You can attach this policy to the following API flows:
  • REST
  • SOAP
Note: If you are using the DataPower API Gateway, the input to the XSLT policy must be parsed data. One way to produce parsed data is to use a Parse policy before an XSLT policy in your assembly flow, which provides explicit control of the parse action.

Properties

The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.

Table 2. XSLT policy properties
Property label Required Description Data type
Title Yes The title of the policy.

The default value is xslt.

string
Description No A description of the policy. string
Use context current payload No Indicates whether this XSLT input document uses the context current payload, or if there is no input.

The check box is cleared by default, which indicates that there is no input.

boolean
DataPower API Gateway
onlySerialize output No If you select this option, the output tree that is generated by the XSLT policy is serialized. The content of message.body is updated with the serialized binary data rather than the XML tree.

The check box is cleared by default, which indicates that the output tree is not serialized.

boolean
Source Yes The XSLT transform source to execute. string

For examples of the OpenAPI definitions of XSLT policies, see XSLT policy examples.

For more examples of how to use XSLT to access and modify properties and context, see Implementation code examples and, if you are using the DataPower API Gateway, Using context variables in GatewayScript and XSLT policies with the DataPower API Gateway.

Errors

The following error can be thrown while the policy is being executed:
  • TransformError - a generic error that captures all errors that occur during the execution of the policy.