Specification: Expressions

ISML Expressions

ISML expressions let you embed programming logic, using a business API, into a template to generate dynamic content. The syntax and semantics of these expressions is based on JavaScript and similar to those defined for JSP expressions. ISML provides SGML-like extension tags. Along with HTML code, they describe how dynamic data is embedded and formatted.

Script expressions can be embedded directly in the template or used in tag attributes. Template programming via scripting isn’t limited to expressions. Extended programming logic can be expressed via scriptlets (see <isscript> for details).

Expressions have the following syntax:

 ${...}

where ${ is the opening identifier, and } is the closing identifier. The content enclosed within is interpreted as an expression.

Given that pages are dynamically generated, you need a way to call and present dynamic data in templates. Any data to be presented within a template must be available via the Pipeline Dictionary. ISML expressions provide access to the pipeline data.

Syntax:

${pdict.<KeyAttributeName>}

Using the

Tag

The </body> tag is a protected keyword in ISML. You must not use the </body> tag in ISML comments and JavaScript. If you do, you must obfuscate it in JavaScript, as in this example:

var endbdy = data.indexOf("</bo" + "dy>");

Examples

This example shows an expression embedded as an attribute value in an ISML tag:

<isprint value="${pdict.Product.name}">

This example accesses data (via a get method) that is stored in the Pipeline Dictionary:

"${pdict.Product.getLongDescription() != null}"

This example allows complex arithmetical, Boolean, and string operations; and includes a set of special functions such as URLUtils.url() and URLUtils.WebRoot():

<form action="${URLUtils.continueURL()}"
  method="post"
  id="${pdict.CurrentForms.cart.htmlName}"
>

Additional Examples

ExampleDescription
${pdict.Product}Refers to a product.
${pdict.Content.template}Refers to a content object.
${pdict.ProductPrices}Refers to product prices.
${pdict.Order.orderNo}Refers to the order number.