xslTransform Step

Use this step to perform XSL transform on XML document.

Last published at: June 14th, 2024

Description:

Performs an XSL transform on an XML document.

 

Inputs

  • xmlVariable – variable holding the XML data
  • xslFilePath – file path to the XSLT file on the FlowWright server
  • variableToStore – variable to store the XSL transform result 
 

 

Returns

  • True – step executed successfully
  • False – step failed to execute 
 

 

Usage:

 

 

Example:

Let’s build and execute the “xslTransformDef” example.          

  • Create a new definition called “xslTransformDef” 
  • Select the definition and click the “design” button
  • Drag the above steps from the toolbox and connect as shown above
  • Define a variable/global to store the XML value and XSL transform result after execution
  • Click the "updateVariable" step to configure its "Settings" properties. Provide a name to the step.

 

  • Click the "updateVariable" step to configure its "Advanced" properties. Provide the variable/global reference and the XML value. Configure “Yes” if the XML value has an expression. Click on the button to configure multiple variables, as shown below.  

 

  • Provide multiple variable reference and XML values (not both at the same time)

 

  • Sample XML value (for reference)
<root>
  <Book1>
    <MaterialID>123456789</MaterialID>
    <MaterialName>Roman Test</MaterialName>
    <Quantity>123.6</Quantity>
    <UoM>Kg</UoM>
    <Tolerance>2</Tolerance>
  </Book1>
  <Book1>
    <MaterialID>123456790</MaterialID>
    <MaterialName>Roman Test 2</MaterialName>
    <Quantity>133.6</Quantity>
    <UoM>Kg</UoM>
    <Tolerance>3</Tolerance>
  </Book1>
  <Book1>
    <MaterialID>123456791</MaterialID>
    <MaterialName>Roman Test</MaterialName>
    <Quantity>143.6</Quantity>
    <UoM>Kg</UoM>
    <Tolerance>4</Tolerance>
  </Book1>
  <Book1>
    <MaterialID>123456792</MaterialID>
    <MaterialName>Roman Test 3</MaterialName>
    <Quantity>153.6</Quantity>
    <UoM>Kg</UoM>
    <Tolerance>5</Tolerance>
  </Book1>
  <Book1>
    <MaterialID>123456793</MaterialID>
    <MaterialName>Roman Test</MaterialName>
    <Quantity>163.6</Quantity>
    <UoM>Kg</UoM>
    <Tolerance>6</Tolerance>
  </Book1>
</root>

 

  • The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • Click the "xslTransform" step to configure its "Settings" properties. Give the step a name.

 

  • Click the "xslTransform" step to configure its "Advanced" properties. Provide the variable/global to store the XSL transform output, the variable/global that holds the XML value, and the XSL file path value on the app server. 

 

  • Sample XSL file template (for reference)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>The List</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>MaterialID</th>
        <th>Name</th>
		<th>Quantity</th>
		<th>Unit Of Measure</th>
		<th>Tolerance Value</th>
      </tr>
      <xsl:for-each select="root/Book1">
      <tr>
        <td><xsl:value-of select="MaterialID" /></td>
        <td><xsl:value-of select="MaterialName" /></td>
        <td><xsl:value-of select="Quantity" /></td>
        <td><xsl:value-of select="UoM" /></td>
        <td><xsl:value-of select="Tolerance" /></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

 

  • The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • Save the process definition, create a new process instance, and execute. 
  • Render the process instance. Click on the process step. The step shall transform the XML to XSL using the template file.