Generate XML via XSLT-template
Description
The Generate XML via XSLT-template part is available in project nodes in the App Dev dropdown menu. You can use this part to create an XML document using a translation template that specifies how to format the document and which data objects to output in a specific way.
Use
You can use the required template from the resources\documents folder of the same LogicNets project. The following is a basic template example and the file format is XML:
Interpolation is used for obtaining the actual values to be inserted into the specified places.
The system interprets all XML nodes starting with xsl: as commands to allow reuse of output template definitions and to specify how to print data objects. The select attribute specifies the name of the object without interpolation.
The system interprets the following commands:
Command | Action |
xsl:import-session | Import the current session data and write it as base64-encoded content. |
xsl:import | Write the content of a container object instead of a text object. |
xsl:plain-text-string | Simple text write. The system strips the HTML content of the string. |
xsl:for-each-k-v | Write the data object as key/value pairs. |
xsl:for-each-k-v-simple | Write the values of a data object. |
xsl:for-each-k-v-in-collection | Write the values of a collection data object. |
xsl:collection-to-string | Write the collection data object as a concatenated string. Specify the separator as attribute; for example, separator="|">. |
xsl:for-each | Write simply the values of a collection data object. |
xsl:xsl-escape-html | Write the text data object with enforced HTML escaping. You can use this to prevent broken XML if there are illegal characters in the text. |
xsl:xsl-base64 | Write the data object as base64-encoded string. |
xsl:if | Make the internal nodes conditional; for example, test="'$(settings.ExportText)' ~='no'">. You can use the ctx attribute to specify the context to extract the variables for the test attribute. Use base for the root object specified in the Data Source parameter. |
xsl:template | Defines a reusable template. |
xsl:include-template | Specify that a configured template should be printed; for example, group="templates.example"/>. |
Editor Fields
Field Name | Description/Use | Type/Options | Optional/Mandatory |
Data Object | This is the name of the data object in which the messages will be stored. | Data Object | Mandatory |
Filename of XSLT-template | This is the name of the translation file. | Document Reference | Mandatory |
Data source | This is the data object containing the content used by the template. If you do not specify this item the system uses the running context of the logicnet. | Data Object | Options |
Example
Download and import the following example project in your workspace.