EPScript/Functions
Revision as of 14:50, 20 February 2022 by Drn@ecs.soton.ac.uk (talk | contribs) (Switched back to basic navigatiom template)
EPScript | ||
Contents
Functions
Calling Functions
Functions can be called in two ways:
<when test="is_set( creators )">
or
<when test="creators.is_set">
These are interchangable, but it may be beneficial to use a specific form in some cases.
Generic Functions
is_set
Returns true if the parameter is set, based on the following criteria:
- If the parameter is a string, it is set if it is not empty.
- If the parameter is a list or a complex structure, it is set if at least one value is set.
<when test="is_set( creators )"> ... </when>
List Functions
length
Returns the number of items in the list.
<if test="length(editors) gt 1">s</if>
String Functions
one_of
Returns true if the string is in the list of strings provided.
<when test="type.one_of( 'book','book_section' )"> ... </when>
reverse
Returns the reverse of a string (i.e. 'abc' becomes 'cba').
<when test="type.reverse = 'tnetap'"> ... </when>