Altova StyleVision 2023 Enterprise Edition

In an SPS, user-declared parameters are declared globally with a name and a default string value. Once declared, they can be used in XPath expressions anywhere in the SPS. The default value of the parameter can be overridden for individual XSLT transformations by passing the XSLT stylesheet a new global value via StyleVision Server.

 

Use of parameters

User-declared parameters are useful in the following situations:

 

If you wish to use one value in multiple locations or as an input for several calculations. In this case, you can save the required value as a parameter value and use the parameter in the required locations and calculations.

If you wish to pass a value to the stylesheet at processing time. In the SPS (and stylesheet), you use a parameter with a default value. At processing time, you pass the desired value to the parameter via StyleVision Server.

 

Usage mechanism

Working with user-declared parameters in the SPS consists of two steps:

 

1.Declaring the required parameters.

2.Referencing the declared parameters.

 

Declaring parameters

All user-defined parameters are declared and edited in the Edit Parameters dialog (screenshot below). The Edit Parameters dialog is accessed via: the Edit | Stylesheet Parameters command and the Parameters button in the Edit Database Filters dialog (Edit | Edit DB Filter).

 

dlg_edit_params1

 

Declaring a parameter involves giving it a name and a string value—its default value. If no value is specified, the default value is an empty string.

 

To declare a parameter, do the following:

 

1.In the Edit Parameters dialog, append or insert a new parameter by clicking the Append or Insert buttons. A new line appears.

2.Enter the name of the parameter. Parameter names must begin with a letter, and can contain the characters A to Z, a to z, 0 to 9, and the underscore.

3.Enter a default value for that parameter. The value you enter is accepted as a text string.

 

You can insert any number of parameters and modify existing parameters at any time while editing either the SPS or Authentic View.

 

Note:

 

The Edit Parameters dialog contains all the user-defined parameters in an SPS.

Parameters can also be declared in the Design Overview sidebar.

 

Referencing declared parameters

Parameters can be referenced in XPath expressions by prefixing a \$ character before the parameter name. For example, you could reference a parameter in the XPath expression of an Auto-Calculation (e.g. concat('www.', \$company, '.com')). If your SPS is DB-based, then you can also use parameters as the values of DB Filter criteria. The DB parameters, however, are declared and edited in the Edit Parameters dialog.

 

Note:While it is an error to reference an undeclared parameter, it is not an error to declare a parameter and not reference it.

 

© 2017-2023 Altova GmbH