This topic explains how to configure and apply the XML Transformer tool, which gives you XSLT-like functionality to transform any XML.
Sections include:


Configuring XML Transformer

You can configure the following options:


Parameterizing XPaths

You can parameterize XPaths to reference Responder suite variables, environment variables, and data source values.  The syntax to reference variables is ${myVariableName}. The syntax to reference XML Data Bank values and Data Source Values is: ${myColumnName}. 

For example, if ${XPath Key} is a data source column name, you could use

/*[local-name(.)="bookstore" and namespace-uri(.)=""]/*[local-name(.)="book" and

namespace-uri(.)=""][child::node()[local-name(.)="title" and text()="${XPath Key}"]]

Handling Empty Elements to Maintain the Integrity of the XML Response

By default, empty elements will not be extracted.  This could impact the integrity of the XML response for use in a Writable Data Source. For instance,

<e>5</e>
<e/>
<e>6</e>
would produce a Writable Data Source that looks like


ROW 1 = 5
ROW 2 = 6
If you prefer to have all nodes—including empty elements—represented in the extraction:
  1. Enable Extract empty elements as.
  2. (Optional) If you want a "placeholder" value to be added for every empty extracted element, indicate the desired placeholder string in the adjacent text field.


     
  3. Select one of the XPaths that specifies what to extract, then click Modify.
  4. Ensure that the Extract option is set to Content only.
  5. Delete the /text() at the end of the related XPath(s) For example, if the current XPath is 

    /*[local-name(.)="Envelope" and namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"]/.../*[local-name(.)="i" and namespace-uri(.)=""][1]/text()

    Edit it to

    /*[local-name(.)="Envelope" and namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"]/.../*[local-name(.)="i" and namespace-uri(.)=""][1]




  6. Repeat steps 3-5 for additional XPaths as needed.