Altova StyleVision 2023 Basic Edition

Parameters for Design Fragments

Home Prev Top Next

Parameters for Design Fragments enable you to define a parameter on a design fragment you have created and to give this parameter a default value. At each location where this design fragment is used in the design, you can enter a different parameter value, thus enabling you to modify the output of individual design fragments.

 

For example, a design fragment named EMailAddresses can be created with a parameter named Domain that has a default value of altova.com. Now, say this parameter is used in an Auto-Calculation in the design fragment to generate the email addresses of company employees. For the EU addresses, we could use the design fragment EmailAddresses and edit the value of the Domain parameter to be altova.eu. In the same way, in the template for Japanese employees, we could edit the value of the Domain parameter to be altova.jp. For the US employees of the company, we could leave the parameter value of Domain unchanged, thus generating the default value of altova.com.

 

Using parameters for design fragments consists of two parts:

 

1.Defining the parameter with a default value on the design fragment where it is created.

2.Editing the parameter value where the design fragment is used.

 

These parts are explained in detail below.

 

Note:Parameters for Design Fragments are supported in Authentic View only in the Enterprise Editions of Altova products.

 

Defining the parameter

Each design fragment can be assigned any number of parameters. To do this, click the Define Parameters link in the title bar of the design fragment (see screenshot below).

 

DefineParams4DesFrags

 

This pops up the Define Parameters for Design Fragments dialog (screenshot below). Click the Append or Insert icon at top left to add a parameter entry line. Enter or select the name, datatype, number of occurrences, and default value of the parameter. The Occurrence attribute of the parameter specifies the number of items returned by evaluating the XPath expression specified as the default value of the parameter. The Occurrence attribute is optional and is, by default, none or one. You can add as many parameters as you like.

 

Params4DesFrags

 

There are two types of Delete icon. The Delete icon to the right of each parameter entry deletes the default value of that parameter. The Delete icon at the top right of the pane deletes the currently highlighted parameter.

 

Note:If the SPS uses XSLT 1.0, then the XPath expression you enter must return a node-set. Otherwise an error is reported.

 

Using the parameter

After a design fragment has been created, it can be inserted at multiple locations in the design (by dragging it from the Design Tree or Schema Tree). The screenshot below shows the design fragment EmailPerson, inserted after the n1:Name element.

 

DesFragsUse

 

If a parameter has been defined for this design fragment, then its value can be edited for this particular usage instance of the design fragment. Do this by right-clicking the design fragment and selecting the command Edit Parameters. This pops up the Edit Parameters for Design Fragments dialog (screenshot below).

 

EditParamsForDesFrags

 

You can edit the value of the parameter in this dialog. Click OK to finish. The new parameter value will be used in this usage instance of the design fragment. If the parameter value is not edited, the original (or default) parameter value will be used.

 

Note:If XSLT 1.0 is being used, then the XPath expression must return a node-set. Otherwise an error is reported.

 

© 2017-2023 Altova GmbH