Difference between revisions of "EPScript/Data Types"

From EPrints Documentation
Jump to: navigation, search
Line 14: Line 14:
 
</pre>
 
</pre>
 
}}
 
}}
 +
 +
===Numbers===
 +
 +
==Logical Operators==
 +
 +
===and===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="type = 'book' and is_set( creators )">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
===or===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="type = 'book' or type = 'patent'">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
===not===
 +
 +
{{codesample|
 +
<pre>
 +
<if !is_set( creators )">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
==Comparison Operators==
 +
 +
===lt===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="length(editors) lt 6">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
===gt===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="length(editors) gt 1">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
===equals===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="type = 'patent'">
 +
...
 +
</if>
 +
</pre>
 +
}}
 +
 +
==Control Structures==
 +
 +
===if===
 +
 +
{{codesample|
 +
<pre>
 +
<if test="date_effective">(<print expr="date_effective" opts="res=year" />)</if>
 +
</pre>
 +
}}
 +
 +
===choose/when/otherwise===
 +
 +
{{codesample|
 +
<pre>
 +
<choose>
 +
  <when test="title"><print expr="title" /></ep:when>
 +
  <otherwise><print expr="type" /> #<print expr="eprintid" /></otherwise>
 +
</choose>
 +
</pre>
 +
}}
 +
 +
==Procedures==
 +
 +
===print===
 +
 +
{{codesample|
 +
<pre>
 +
<print expr="isbn" />
 +
</pre>
 +
}}
 +
 +
===phrase===

Revision as of 08:57, 4 October 2006

EPScript

Data 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>


Numbers

Logical Operators

and

<if test="type = 'book' and is_set( creators )">
...
</if>


or

<if test="type = 'book' or type = 'patent'">
...
</if>


not

<if !is_set( creators )">
...
</if>


Comparison Operators

lt

<if test="length(editors) lt 6">
...
</if>


gt

<if test="length(editors) gt 1">
...
</if>


equals

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


Control Structures

if

<if test="date_effective">(<print expr="date_effective" opts="res=year" />)</if>


choose/when/otherwise

<choose>
  <when test="title"><print expr="title" /></ep:when>
  <otherwise><print expr="type" /> #<print expr="eprintid" /></otherwise>
</choose>


Procedures

print

<print expr="isbn" />


phrase