Menu

setBooleanFormat

Creates a format that can be used with Boolean values. By default, Boolean values appear as "true" and "false", but this format lets you print them as "yes" and "no", for example.

Attributes

name

Required
Value type
EL-evaluated
No String Yes
Defines a name for the created format. If defined, other commands can choose to use this format by referring to it by this name.  

Leaving the created format nameless declares it as the default format for Boolean values. Any command that prints out a Boolean value will then use this format, unless the command specifies a named format for itself. If a default format for Boolean values has already been set, this new format will take its place as the default.
trueString

Required
Value type
EL-evaluated
No String Yes
Specifies the String that the Boolean value true will appear as when printed.
falseString

Required
Value type
EL-evaluated
No String Yes
Specifies the String that the Boolean value false will appear as when printed.

Examples

Setting Booleans to be printed out as "Yes" and "No" by default can be done like this:

<setBooleanFormat trueString="Yes" falseString="No">

Named Boolean formats could be defined to print out the actual meanings of what the Boolean is representing:

<setBooleanformat name="limitedFormat" trueString="Limited" falseString="Standard">

And then in the document this format could be used where needed:

<p>Edition type: <span dyn-content="product.edition.isLimited" dyn-content-format="'limitedFormat'">isLimited</span></p>

The paragraph's content would then end being either "Edition type: Limited" or "Edition type: Standard".

Comments

0 comments