Difference between revisions of "EPScript/Data Types"

From EPrints Documentation
Jump to: navigation, search
Line 1: Line 1:
{{Navigate-First|Section=EPScript|Curr=Syntax|Next=Operators}}
+
{{Navigate-First|Section=EPScript|Curr=Data Types|Next=Operators}}
  
=EPScript=
+
= Data Types =
 +
== Primitive Types ==
  
==Data Types==
+
=== Strings and characters ===  
 
 
===Strings and characters===  
 
  
 
These are contained within either double quotes ("") or single quotes (<nowiki>''</nowiki>). There is no difference between the two, but it may be easier to use one sort when inside an XML attribute. For example:
 
These are contained within either double quotes ("") or single quotes (<nowiki>''</nowiki>). There is no difference between the two, but it may be easier to use one sort when inside an XML attribute. For example:
Line 17: Line 16:
 
}}
 
}}
  
===Integers===
+
=== Integers ===
  
 
Integers are defined as a string of numbers from 0-9, e.g. 300. Leading zeros do not have any effect, and decimal values are currently not supported.  
 
Integers are defined as a string of numbers from 0-9, e.g. 300. Leading zeros do not have any effect, and decimal values are currently not supported.  
  
 
+
== Data Objects ==
 
 
==Logical Operators==
 
 
 
===and===
 
 
 
Returns true if both the left-hand and the right-hand expressions return true.
 
 
 
{{codesample|
 
<pre>
 
<if test="type = 'book' and is_set( creators )">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
===or===
 
 
 
Returns true if at least one of the expressions returns true.
 
 
 
{{codesample|
 
<pre>
 
<if test="type = 'book' or type = 'patent'">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
===not===
 
 
 
Returns true if the expression is false and false if the expression is true.
 
 
 
{{codesample|
 
<pre>
 
<if test="!is_set( creators )">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
==Comparison Operators==
 
 
 
===lt===
 
 
 
Returns true if the left-hand expression is less than the right-hand expression. This is only applicable to expressions that return numeric values.
 
 
 
{{codesample|
 
<pre>
 
<if test="length(editors) lt 6">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
===gt===
 
 
 
Returns true if the left-hand expression is greater than the right-hand expression. This is only applicable to expressions that return numeric values.
 
 
 
{{codesample|
 
<pre>
 
<if test="length(editors) gt 1">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
===equals===
 
 
 
Returns true if the left-hand expression is equal to the right-hand expression. This applies to numeric, boolean, and string values.
 
 
 
{{codesample|
 
<pre>
 
<if test="type = 'patent'">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
===not equals===
 
 
 
The inverse of the equals operator, this returns true if the expressions are not equal.
 
 
 
{{codesample|
 
<pre>
 
<if test="type != 'book'">
 
...
 
</if>
 
</pre>
 
}}
 
 
 
==Control Structures==
 
 
 
===if===
 
 
 
Inserts the content of the <if> element if the EPScript in the test attribute returns true.
 
 
 
{{codesample|
 
<pre>
 
<if test="date_effective">(<print expr="date_effective" opts="res=year" />)</if>
 
</pre>
 
}}
 
 
 
===choose/when/otherwise===
 
 
 
A <choose> element consists of one or many <when> elements and an optional <otherwise> element. The test attribute of each <when> element is evaluated, and if this returns true the content is included and execution leaves the <choose> structure. If <i>no</i> test attribute returns true and an <otherwise> element is provided, the content of the <otherwise> element is included.
 
 
 
{{codesample|
 
<pre>
 
<choose>
 
  <when test="title"><print expr="title" /></ep:when>
 
  <otherwise><print expr="type" /> #<print expr="eprintid" /></otherwise>
 
</choose>
 
</pre>
 
}}
 
 
 
==Procedures==
 
 
 
===print===
 
 
 
Outputs the result of the provided expression attribute as a string. If the result is boolean, TRUE or FALSE will be produced.
 
 
 
{{codesample|
 
<pre>
 
<print expr="isbn" />
 
</pre>
 
}}
 
 
 
===phrase===
 
 
 
Outputs the phrase given in the ref attribute. To provide values for pins in the phrases, the param element is used, with the name attribute giving the pin name and the element content the value to pass.
 
 
 
{{codesample|
 
<pre>
 
<phrase ref="my_phrase"><param name="my_pin">Pin Value</param></phrase>
 
</pre>
 
}}
 

Revision as of 14:16, 4 October 2006

EPScript
Data Types Operators
EPScript

Data Types

Primitive Types

Strings and characters

These are contained within either double quotes ("") or single quotes (''). There is no difference between the two, but it may be easier to use one sort when inside an XML attribute. For example:


<when test="type = 'patent'">
...
</when>


Integers

Integers are defined as a string of numbers from 0-9, e.g. 300. Leading zeros do not have any effect, and decimal values are currently not supported.

Data Objects