XSL-FO Designer for Apache FOP


14. Flavours

You can use flavours to change the look of a field or combo box based on a condition. Each field has a default flavour , but you can add new ones and assign a condition to them. For each flavour you can define a font, border, color and all the set of properties of the field.

We deliver an example in the file which has a field with 2 flavours:


This report creates an output like this:

the amount field will get a red color if the value is over 1000. In order to achieve this, the process has been:

  1. Select the amount field and from the main menu execute create a new flavour:

    Once the flavour has been added, you can select it from the "Flavour" combobox (see below). The initial name of the new flavour will be New_<timestamp>.
  2. The flavours section of the field properties has 3 entries:
    1. The combobox "Flavour" is used to select the current flavour you are working on.
    2. The "Name" entry, is the name of the current flavour. Use the entry to change the name of the flavour.
    3. The "Condition" field, is a XPath condition which defines when the flavour should be used. You should have one flavour without a condition, which will be the default one. If you have more than 1 flavour without condition, they will be ignored, since only the default flavour may have an empty condition.

In this example we have defined a new flavour called "Over1000" and we have set the condition to be "/Order/OrderDetail/ListOfItemDetail/ItemDetail/PricingDetail/TotalValue/MonetaryValue > 1000 ". The font color of the flavour has been set to red.