Syntax
npsobj_condition::= ( <npsobj condition = "unary_condition" data [ negate = "" ] [ separator = "separator" ] [ format = "format_name" ] > content </npsobj>) | ( <npsobj condition = "binary_condition" data1 data2 [ negate = "" ] [ separator = "separator" ] [ format = "format_name" ]> content </npsobj> ) unary_condition::= isEmpty | isNotEmpty | isNil | isNotNil binary_condition::= isEqual | isNotEqual | isGreaterThan | isLessThan | hasPrefix | hasSuffix | isCaseEqual | matches data::= ( value = "value" ) | ( name = "name" ) data1::= ( value1 = "value" ) | ( name1 = "name" ) data2::= ( value2 = "value" ) | ( name2 = "name" )
Task
By means of this instruction you can make the export of a piece of
text depend on a condition. The condition to be applied is defined by
specifying a condition name such as isEqual as the value
of the condition tag attribute (see the complete list of
condition names below). The operands of the condition are defined by
means of further attributes.
At first, the condition is evaluated. If it is true the entire
NPSOBJ element is replaced by content. If it is
not true, the NPSOBJ element is replaced by the empty string.
If the parameter negate is specified, the value of the
condition that results according to the following specification for the
individual values for condition is negated. Only
then is the decision made, whether the element is to be replaced by
content or by the empty string.
The evaluation of data, data1, and
data2 follows the same scheme. It is defined for
data here:
If value="value" is specified, then the value of
data is the constant value. If
value is not specified and name="name"
is specified, then the value of data is the result of the
evaluation of name as a string with the separator
separator and the date format
format_name. If (erroneously) neither the
value attribute nor the name attribute are
given, the value from data is the empty string. If
(erroneously) value="value" and
name="name" are specified,
name="name" is ignored.
The separator must be specified if name has been
specified and name references a list. This is the
case with the values of multiple selection type fields.
Please note that in binary conditions name and
value must be used with the subscripts 1 and
2. With the condition types hasPrefix,
hasSuffix, isGreaterThan,
isLessThan, and matches the subscript
determines whether the operand is on the left or right side of the
operator.
isEmpty, isNil
These conditions are true if the value of data
evaluates to an empty string or list, or if it does not exist. The two
conditions are isomorphic. isNil is available for
compatibility reasons.
isNotEmpty, isNotNil
These conditions are true if the value of data exists
and evaluates neither to an empty string nor to an empty list. The two
conditions are isomorphic. isNotNil is available for
compatibility reasons.
isEqual
The condition is only true if the value of data1 is
identical character by character with the value of
data2.
isNotEqual
The condition is only false if the value of data1 is
identical character by character with the value of
data2.
isGreaterThan
The condition is only true if the value of data1 is
greater than the value of data2. The values are compared
character by character from left to right. Date values are converted to
their 14-character ISO representation prior to the comparison and lists
are converted to strings. By negating the condition, a less-than-or-equal
comparison can be performed.
isLessThan
Analogously to isGreaterThan, the condition is only true
if the value of data1 is less than the value of
data2. By negating the condition, a greater-than-or-equal
comparison can be performed.
hasPrefix
The condition is only true if the beginning of data1 is
identical character by character with data2.
hasSuffix
The condition is only true if the length n of data2 is
smaller than that of data1 and the last n characters of
data1 are identical character by character with
data2.
isCaseEqual
The condition is only true if the value of data1 is
identical character by character with the value of data2,
whereby upper and lower case differences are not observed.
matches
The condition is only true if the value of data1 matches
the regular expression data2. If data2 is not a
valid regular expression, then the condition is false. If
data2 is a null string, the condition is true.
Regular expressions must obey the extended POSIX syntax. Please note that the functions actually available depend on the POSIX ERE implementation in the operating system used. In the following list the special symbols and their meaning is explained:
[ ] |
In square brackets a range of symbols is specified in
which the examined symbol must be found in order for the regular
expression to match. If the examined character must not be found in
the range of symbols, then the symbol ^ must be added
as a prefix to the range. The minus sign can be used as a literal
if it occurs as the first or last symbol. [=-] matches
the characters = and -. Examples:
[abc], [a-z], [^0-9] |
* |
The * after a component of a regular
expression means: can occur any number of times (or not at all).
Example: 1[a-z]*[0-9] |
. |
The period represents exactly one wildcard character. |
^ |
The symbol ^ at the beginning of an
expression requires the comparing string to match the regular
expression from the beginning. Within square brackets the symbol
means that the comparing string must not be contained in the
specified range. |
$ |
The symbol $ at the end of an expression
requires the comparing string to match the regular expression from
the end. \n corresponds to a new line. |
+ |
The plus sign after a regular expression means once
or more. For example [0-9]+ has the same meaning
as [0-9][0-9]*. |
( ) |
Brackets are used for grouping. An operator such as
* or + can be used on an individual
character or on a regular expression enclosed in brackets. Example:
(a*(cb+)*). |
{ } |
Curly braces are used for quantification. Placed after
an element, {n},
{n,m}, or
{n,} requires that the element occurs
n times, n to m times, or at least
n times, respectively. Example: [0-9]{14} |
| |
The vertical bar means or. Example: (abc|def). |
All of the symbols listed above must be preceded with a backslash character in order for them to be used as literals.
Example
In the following example in a link context a link will only be
generated if the URL contains the string ://. This is only
true, if the link is an external link.
<npsobj name1="destinationUrl" value2="://" condition="matches">
<npsobj insertvalue="anchor" name="destinationUrl">
<npsobj insertvalue="var" name="displayTitle"/>
</npsobj>
</npsobj>