EPScript/Functions

From EPrints Documentation
Revision as of 15:14, 4 October 2006 by Moj (talk | contribs) (Functions)
Jump to: navigation, search
EPScript
Operators Functions XML Syntax
EPScript

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>