logo of XML Sapiens
XML Sapiens Yahoo Group
Join Now
3.4 SAPI Expressions
Beginning » XML Sapiens v.1.1 Specification » 3. SAPI Architecture » 3.6 SAPI Expressions

SAPI expressions can be used to describe the logic of functional solutions in dynamic data containers. While developing the expression operands the constructions of the XML script language XEXPR (http://www.w3.org/TR/2000/NOTE-xexpr-20001121/) where used. The SAPI specification supports expressions of comparison. There expressions can return one of the two values (0 or1), meaning respectively either FLASE or TRUE

In the content of attributes SAPI specification allows the following expression operands:

lt(A, B, C) (less), leq(A, B, C) (less or equal), geq(A, B, C) (more or equal), eq(A, B, C) or == (equal), neq(A, B, C) or != (not equal), gt(A, B, C) (more). A B C — values, separated by commas. For grouping the expressions, it is allowed to use round brackets, and logic operands as well: and(A, B, C) or AND(A, B, C) and or(A, B, C) or OR(A, B, C).

It is also allowed to use mathematic operands: add(A, B, C) or + (add — for numerals, merge — for strings), subtract(A, B, C) or — (substraction), multiply(A, B, C) or * (multiplication), divide(A, B, C) (division).

SAPI expressions allow direct reference CMS environment variables. E.g.

<sapi:for-each select="get_tree()" >

<sapi:choose>

<sapi:when exp="neq(this.variable.value, last_argv.value)">

<sapi:code>

<a sapi:href="this.this.href.value">

<sapi:apply name="this.this.title.value" />

</a>

</sapi:code>

</sapi:when>

</sapi:choose>

</sapi:for-each>

The expressions can be used in the EXP attribute of the SAPI:WHEN element, in the SELECT attribute of the SAPI:FOR-EACH element, in the EXP attribute of the SAPI:APPLY element or in the attributes of SAPI:%Attrib format

If it is necessary to get the executive result of the SAPI expression, the following syntaxes can be used in container code (SAPI:CODE element)

<sapi:apply exp="add(http_path.value, qc.link.value)" />

(C) 2004-2006 Red Graphic Systems. All Rights Reserved. Red Graphic Systems liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.