Pass external parameters to a template

Top Previous Topic Next Topic  Print this topic

This section offers an example of how to pass external parameters to a template.

This can be done using the command line or the Command Center.

 

1. Firstly, a new .XFD document must be created in XF Designer and a XML data source assigned to it. Then, the Edit parameters button located in the Template group, under the Review tab must be selected.

 

parameters2

 

2. The parameter must be added to the template, by selecting the Add button. The following dialog will be displayed, where the Name and Default Value of the parameter must be set.

 

passparameter

 

passparameter2

 

3. After adding the parameter, it can be found in the Edit Expression dialog, located under the Parameters selection.

 

passparameter3

 

4. For using the parameter, a Conditional Section must be inserted by selecting the corresponding button located in the Dynamic Content group, under the Insert tab.

 

passparameter4

 

 

5. To use the parameter, the Add button must be selected and the Expression field edited.

 

 

passparameter5

 

6. Then, the condition and fallback section must be customized.

 

 

Passing an external parameter from command line

 

To pass an external parameter from command line, the Render.exe application can be used to process the template.

 

1. A new command window in C:\Program Files\Ecrion\XF Ultrascale 2013 vvX.X.X\Bin folder must be opened.

 

IMPORTANT: It is mandatory for the user to have writing access on C:\

 

2. The following line must be typed in:
 

 

       Render.exe -xsl Sample.xfd -xml Sample.xml -pdf Output.pdf -parameters:xsltparameters=(param1,value1)(param2,value2)

 

 

Note:

The parameters must be defined in the .xsl or .xfd template before passing them from command line.

 

 

Passing parameters in .NET using a Hashtable

 

 

using System.Collections;

using Ecrion.Ultrascale;

 

 

Hashtable p = new Hashtable();

 

p["param"] = test;

 

LocalDocumentTemplate lt = new LocalDocumentTemplate("Sample.xfd", p);

 

ServerDocumentTemplate st = new ServerDocumentTemplate("app:Sample.xfd", p);

 

 

 

 

Passing parameters in Command Center

 

1. The XML data source must be added as input document (by selecting the Add Files button located under the Home tab) and then the local template set. To set the template, the Setting button located in the Options group must be accessed. The XF Rendering Server Settings dialog will be displayed, from where the Apply Template option can be selected.

 

cmd-center-param

 

2. Then, the new values that will be passed to the parameters must be set accessing the Advanced button from the dialog presented above.

 

The Template Configuration dialog that allows the user to modify settings regarding the assigned template will be displayed.

 

cmd-center-param3

 

3. To set the new values for the parameters, the Edit button corresponding to the XSLT Parameters field must be selected.

 

cmd-center-param2

 

4. When rendering the file, the new values for the parameters will be applied.