When using data services, the user may come across the need to transform the result as they wish. This is handled in WSO2 Data Services Server using XSLT Transformation, where the user can define the transformation in xslt and provide the url of the transformation file in the result element.
About the sample
The sample data service (ExcelSampleService), which we use for this demonstrations consists of two operations:
- getProducts - Lists all the products that are manufactured in the company, each result record will contain "ID" and "Name" fields.
- getProductClassifications - Lists all the products along with the classifications, which contains the two result records, "Name" and "classification". Note that this operation's actual output has changed to "product-Name" and "product-classification" because of the xslt transformation.
See Data Services and Resources for a definition of data services and operations.
Building the sample
The sample data service, ExcelSampleService should be deployed using the instructions in Samples Setup.
Running the sample
The sample service can be run using the TryIt tool, which is bundled with the WSO2 Data Services Server, or a code-generated java client sample as discussed in the Data Services Clients section.
Follow the steps below to demonstrate this functionality using the TryIt tool:
- Log in to the management console of your server and click List under Services in the navigator. The ExcelSampleService will be listed here.
- Click Try this service to open the TryIt tool.
- Select "getProductClassifications" operation and click Send to execute. You will get the response as shown below.