[Download] | [Documentation Home] | [Release Note]

XSLT Transformation Sample

Introduction

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 user can define the transformation in xslt and provide the url of the transformation file in the result element.

Prerequisites

The sample data service "ExcelSampleService" should be deployed as per the instructions mentioned in Deploying Samples section.

Running the Sample

The sample service can be run using the "tryit" tool, which is bundled with WSO2 Data Services Server.

Service Definition

The Excel sample data service contains two operations "getProducts" to list all the products that are manufactured in the company, each result record will contain "ID" and "Name" fields. And "getProductClassifications" where to list all the products along with the classifications, which contains two result records which are "Name" and "classification".

Second operation's ("getProductClassifications") actual output has changed as "product-Name" and "product-classification" by using the xslt transformation.

Sample Run

A sample run of the service using the "tryit" tool is shown below.


Figure 1: Excel data service invocation after transforming the result.