|
$vof() Function |
|
|
$vof() function can be used within the values of properties to achieve dynamic data from XML. It is transformed by the Application Studio into appropriate XSL codes depending on where it is used. Example: XML Data:
Usage on Page in the value property of a text element: Name: $vof(/Employee/Name) The Application Studio will compile this definition into the following: <td>Name: <xsl:value-of select="/root/Employee/Name"/></td>
And the result on the browser will be Name: John Watson
Note: We don't have to give the root node since the Application Studio will always include it. The $vof() function can be used in two syntaxes. Syntax 1 $vof(expression [; default-expression ])
First the expression is evaluated. If the result is a value other than the blank then it is used; otherwise the result of the default-expression is used. Syntax 2 $vof(test-expression ; then-expression [; else-expression]) or $vof(test-expression ; then-expression [; test-expression ; then-expression [; else-expression])
Examples: Expression $vof(name) Will be transformed into
Expression $vof(name;'No name given') Will be transformed into
Expression $vof(count > 5 ? 'Greater than 5' ; 'Less or equal to 5') Will be transformed into
Expression $vof(Age < 15 ? 'Kid' ; Age < 30 ? 'Youth' ; Age < 50 ? 'Middle Aged' ; 'Pensioner') Will be transformed into
The Nested Usage The nested usage of the function can be made by enclosing the expressions with parentheses. Example: $vof(A = B ? ( C ; 'X') ; (C = D ? X ; Y)) Will be transformed into
|