How to define Choose statements
Use the choose, when, and otherwise elements to express multiple conditional tests. If certain conditions are met in the incoming XML data then specific sections of the template will be rendered. This is a very powerful feature. In regular XSL programming, if a condition is met in the choose command then further XSL code is executed. In the template, however, you can actually use visual widgets in the conditional flow (in the following example, a cell borders).

Use the following syntax for these elements:

<?choose:?>

<?when:expression?>

<?otherwise?>

This example is displayed in the figure below (download the example). Note that you can't insert the syntax in form fields, only directly into the template:



Choose Statements in Boilerplate Text

Assume you want to incorporate an Choose statement into the following free-form text. For example, to display in cell 'No Number' message when the employee number is empty, insert the syntax

<?choose@inlines:?>

  <?when@inlines:EMPLOYEE_NUMBER=''?>No Number<?end when?>

  <?otherwise@inlines:?><?EMPLOYEE_NUMBER?><?end otherwise?>

<?end choose?>


This example is displayed in the figure below (download the example):

Grau op Friday 06 June 2008 - 08:23:47

  printer friendly   create pdf of this news item