<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  <title>WSO2 EI - XSLT Mediator </title>
  <link href="css/EI-docs.css" rel="stylesheet" />
  <link href="styles/dist-docs.css" rel="stylesheet" type="text/css"
  media="all" />
</head>

<body>
<h2>XSLT Mediator</h2>

<p>The <strong>xslt</strong> mediator applies the specified XSLT transformation 
to the selected element of the current message payload. The <strong>source</strong> 
attribute specifies which element to be selected to apply 
the given XSLT transfomation. In the case where the 
source element is not specified, it uses the first child of the soap body as the 
selected element. Optionally parameters could be passed into
the transformations through the '<strong>property</strong>' elements. These
properties are corresponding to the XSL parameters and can be accessed during
transformation by <strong>&lt;xsl:param name="{the name of the property}"
/&gt;</strong>. The '<strong>feature</strong>' element defines any features
which should be explicitly set to the <strong>TransformerFactory</strong>. The
feature
'<strong>http://ws.apache.org/ns/synapse/transform/feature/dom</strong>' turns
on DOM based transformations instead of serializing elements into Byte streams
and/or temporary files. Though this would be better in performance than using
byte streams, sometimes it may not work for all transformations. </p>

<p>Finally, the '<strong>resource</strong>' element can be used to resolve
<strong>XSLT imports and includes</strong> from the repository. It works in
exactly the same way as the corresponding element in a &lt;proxy&gt; definition
(Proxy Service). </p>

<h3>Syntax</h3>
<pre xml:space="preserve"> &lt;xslt key="string" [source="xpath"]&gt;
   &lt;property name="string" (value="literal" | expression="xpath")/&gt;*
   &lt;feature name="string" value="true| false" /&gt;*
   &lt;resource location="string" key="string"/&gt;*
 &lt;/xslt&gt;</pre>

<h3>UI Configuration</h3>

<p><img src="../xslt-mediator/docs/images/xslt_mediator_screenshot.jpg" alt=""
/></p>

<p><strong>Figure 1. XSLT Mediator</strong></p>

<p><strong>XSLT Mediator</strong> </p>
<ul>
  <li>Key : The registry key to refer the xslt. This supports static and dynamic keys. For
      more information refer <a href="../samples/message_mediation_samples.html#Sample16">
          Sample 16</a> </li>
  <li>Source: Specify in which part of message (specified in xpath) the xslt
    should be applied. Default is the SOAP body of the message. </li>
</ul>

<h2>Properties of the XSLT mediator</h2>

<p>Manage the properties which would be referred from the xslt in
transformation (using get-property(prop-name) xpath extension function). </p>

<p><img src="../xslt-mediator/docs/images/add_properties_screenshot.jpg" alt=""
/> </p>

<p><strong>Figure 2. Add Properties</strong></p>

<p><strong></strong> </p>
<ul>
  <li>Property Name: Name of the property. </li>
  <li>Property Type: Whether it is a static value or an xpath expression. </li>
  <li>Value/ Expression: The static value or the xpath expression. </li>
  <li>NSEditor: Specify the namespaces that are used in the xpath expression.
  </li>
  <li>Action: Delete the property. </li>
</ul>

<h2>Features of the XSLT mediator</h2>

<p>Specify the features to be enabled in the XSLT transformation. Read the
introduction paragraph of this guide for an example feature. </p>

<p><img src="../xslt-mediator/docs/images/add_features_screenshot.jpg" alt=""
/> </p>

<p><strong>Figure 3. Add Features</strong> </p>

<p><strong>XSLT Mediator - Add Features</strong> </p>
<ul>
  <li>Feature Name: Name of the feature. </li>
  <li>Feature Value: Specify whether the feature is turn on (True) or Not
    (False). </li>
  <li>Action: Delete the feature. </li>
</ul>

<p></p>

<h3>Example</h3>
<pre xml:space="preserve"> 
&lt;xslt xmlns="http://ws.apache.org/ns/synapse" key="transform/example.xslt" source="s11:Body/child" /&gt;
</pre>

<p>In this scenario the xslt can be picked by the key <strong>transform/example.xslt</strong> and the XSLT would be applied
to a part of the message that is specified as a XPath expression.In this case it is applied to <strong>s11:Body/child</strong>
the message </p>

<p></p>


<p></p>
</body>
</html>
