Testing XSLT configurations

XSLT provides the ability to use parameters specified at runtime through the use of the element <xsl:param/>. To pass runtime parameters to the XSLT processor, you can set it inside USERDATA message meta-data. This is under the XSLTRuntimeParams key in the Pre-Procs of the XSLT Route Details for XSLT.

For example:

keylget args MSGID mh
# get old USERDATA value
set userData [msgmetaget $mh USERDATA]
# set runtime parameters
keylset userData XSLTRuntimeParams {{PARAM1 Value1} {PARAM2 Value2}}
msgmetaset $mh USERDATA $userData
lappend dispList "CONTINUE $mh"
  • XSLTRuntimeParams contains a keyed list of parameter-value pairs, for example, {{PARAM1 Value1} {PARAM2 Value2}}.
  • The Runtime Parameters field can take a Tcl keyed list of parameter-value pairs that are embraced by double quotes as input.
  • The value entry of each pair should contain a valid XPath expression. In particular, string literals should be enclosed in single quotes. Special characters in Tcl should be escaped using the forward slash.

For example, this is a list of valid runtime parameters:

"{NAME {‘John Doe’}} {COMMENTS {‘THIS IS A \{test\}’}} {XPATH_VALUE {PEOPLE/PERSON}}"
  1. Specify an XSLT file in the XSLT File field. You can also click the folder button to open a file browser from which to select the file to test.
  2. Specify the testing data file in Choose Data File. You can also click the folder button to open a file browser to select the data file. By default, the file browser locates on the $HCISITEDIR/formats/ folder.
  3. Specify Runtime Parameters if required. This field is optional. This takes a Tcl keyed list of parameter-value pairs as input.
  4. Specify the encoding in the Encoding field. You can also click the arrow to open a list of different encodings that identify the encoding of messages in the selected data file. The command converts the messages from the identified encoding to UTF-8 to perform the test. When you select an encoding from the list, an -e encoding option is added to the corresponding command line.
  5. Specify a file name in which to store the output message in the Save To field. You can also click the folder button to open a file browser.
  6. Select the line termination format in which to save the test messages. Click the arrow to open a list of formats.
    Newline Terminated reads the data in the file until it finds a newline character, making all that data one message, and sends that to the parser. It then reads until it finds the next newline character, makes a second message, and sends that to the parser.
    Length Encoded reads the first 10 characters to determine the first message length. Then it reads that many characters into a message, and sends it to the parser.
    EOF Terminated reads the file until it gets to the end-of-file character, takes that as a message, and sends it to the parser.
  7. If required, then select Grep to filter the output.
  8. Click Run Command to run the command shown in Preview Command to Issue.
    As the test is being configured, a command-line command and the requisite parameters are generated in Preview Command to Issue. This is for display only. A command cannot be manually entered.