Creating a CSV Export

Creating a CSV Export

Developing the export definition uses XSLT 1.0 as a processor to generate the text out.

As you are developing, we encourage you to frequently preview the result to understand how your code is working. The source of the preview data is displayed in the "Data Source" panel, as described in Step 6. This data source is populated with the most recent updated 25 records that you also have access to.

We have included a custom function that you can use to help with data formatting. Certain formats such as CSV and JSON require some characters to be handled differently. This can include quotes and commas. The function is called str:sanitize(), and an example of using it is:

<xsl:value-of select="str:sanitize('e123456789')"/>

CSV Exports require a "Header" section for the data to be sorted in the correct column.

For example:


Info
&#10; is the HTML entity for a line break. This is required to let the export module know where the header ends.
The following is the data associated with each column header. The example uses a variety of techniques to get the correct value.  <xsl:for-each select="person"> loops through every person in the data set and retrieves their first name, last name, proprietary ID, and grade. To begin, an opening statement of: is required. This informs the export module that the data portion is beginning.


To call a variable it is required to prepend "$" to the variable name; i.e.: <xsl:value-of select="$fName"/>. starts the next column of the CSV Export.
To end the CSV Export the following is required: .
Idea

Additional Resources

XSLT Data Conversion Transform XML to CSV and JSON: https://piembsystech.com/xslt-data-conversion-transform-xml-to-csv-and-json/
XSLT: Creating New XML/CSV Structure for Transformed Data: https://www.trycatchdebug.net/news/1389321/xslt-transformation-for-xml-csv-structures