KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Passing String Values to SET XSLT PARAMETER
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: September 30, 2004

Enclose string values in straight quotes before passing them to SET XSLT PARAMETER.

The 4th Dimension 2004 command SET XSLT PARAMETER sets the value of an XSLT parameter before an XSLT transformation is performed with APPLY XSLT TRANSFORMATION. The parameters for SET XSLT PARAMETER are summarized below:

SET XSLT PARAMETER(XSLT parameter name;XSLT parameter value)
SET XSLT PARAMETER(Text;Text)

Within XSLT, parameters can be one of several data types. By default, the SET XSLT PARAMETER command assumes that parameter values are numeric. For example, the line of code shown below sets a parameter named fontSize to the value 5 as a number:

SET XSLT PARAMETER("fontSize";"5")

Of course, not all XSLT parameters are numeric. Whenever passing a textual value to SET XSLT PARAMETER, enclose the string in single quotes. The example code below sets a parameter named colorName to the value Light Blue as a string:

SET XSLT PARAMETER("colorName";"'Light Blue'")

Strings that contain numbers can be set like any other string. The example code below sets the parameter named favoriteNumber to the value 5 as a string:

SET XSLT PARAMETER("favoriteNumber";"'5'")