xslTransform Step

Last published at: May 2nd, 2023

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
  • Let’s define a process variable called variable.xmlData (string data type) and variab.output (string data type)
  • Select updateVariables step and configure the the following values for the properties as shown on the below graphic 

  • The XML value used to initialize the process variable.xmlData is here.
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
  </cd>
  <cd>
    <title>Greatest Hits</title>
    <artist>Dolly Parton</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>9.90</price>
    <year>1982</year>
  </cd>
</catalog>
  • Select "xslTransform" step and configure the the following values for the properties as shown on the below graphic. 

  • The XSL (template file) uploaded on the FlowWright server path has the following construct.  
<?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>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Title</th>
        <th>Artist</th>
      </tr>
      <xsl:for-each select="catalog/cd">
      <tr>
        <td><xsl:value-of select="title" /></td>
        <td><xsl:value-of select="artist" /></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
  • Save the process definition, create a new process instance and execute. The step shall transform the XML to XSL using the template file.