Document Tree
Document Properties
Kbid
2Q4786
Last Modified
30-Aug-2021
Added to KB
20-Jun-2013
Public Access
Everyone
Status
Online
Doc Type
References
Product
  • ICM 7.10
  • ICM 11
  • ICM 12
Reference - ISML Expressions

Introduction

ISML expressions encode arithmetical, Boolean, and string operations, as well as special function calls. They are used to perform calculations, to compare values, or to produce new values in combination with functions. ISML expressions are evaluated at runtime every time output is generated from a specific template.

Expressions can be composed of:

Expression Example

A sample ISML expression looks as follows:

#len(sub:DisplayName)>15#

It consists of a function (len(), a template variable sub:DisplayName, and an operator >.
An expression always evaluates to a value of a specific data type as shown in the table below:

Data Type

Description

Scope

double

Numeric data type with a size of 64 bits

minimum value: ±4.94065645841246544E-224, maximum value: ±1.79769313486231570E308

boolean

Logical data type

True or false

string

Alphanumeric data type

Maximum size is 32K

Expression Conventions

Please note the following hints regarding ISML expressions:

  • ISML expressions must be surrounded with pound signs (#).

    Example
    =#len(sub:DisplayName) > 15#
    
  • Do not use expressions outside of tags, in order to be sure that the expressions are properly parsed by HTML editors during the design phase.
  • This is the universal syntactic description of an ISML expression:

    Syntax
    ISML expression := # <operation> #
    
  • You can use different elements to build ISML expressions, see Expressions Syntaxfor details.

Note

Currently, no type check of Intershop 7 template expressions is provided during compile. If types do not match, a runtime exception will occur.

Expression Syntax

The following table lists the different elements that can be used to build ISML expressions.

Element

Syntactic Description

Operation


Arithmetic Compare


String Compare


Arithmetic Expression


String Expression


Boolean Expression


Simple Expression

( ( <function name> ( [<operation>] ( , [<operation>] )* ) ) < Template Variable >, < UserVariable >, <constant>, ( <operation> ) )

ac Operator


sc Operator

EQ , NE

ae Operator

+ , - , * , /

se Operator

.(period)

be Operator

AND , OR

Constant


Function Name

e.g., hasElements, isSSSenabled, getValue, url, urlex, action, parameter, etc. See Reference - ISML Functions for detailed information.

Simple Name

'a-zA-Z' ('a-zA-Z0-9_')*

ISML Template Identifier


ISML Formatting Expression Results

If the result of an expression is printed out to an HTML page, it is often useful if you can specify how this should be done. For example, a date can be formatted in different ways depending on the store's locale:

  • 12 March 1999
  • 12.03.1999
  • 03/12/99

For formatting values of the data types Money, Number, Quantity, Date, and Message, Intershop 7 uses specific standard formatter classes. The table below lists the data types and their appropriate formatter class.

Type of Expression Result

Standard Formatter Class

Money

StaticMoneyFormat

Number

DecimalFormat

Quantity

StaticQuantityFormat

Date

SimpleDateFormat

Message

MessageFormat

General

Please mind the following general notes regarding formatters:

  • All formatters are additionally customized by regional settings.
  • Objects of classes other than Money, Date, Message, Quantity and Number will not be formatted and the result of formatting these objects is not standardized.
  • The EURO-styles are a temporary work-around for the direct support of multicurrency pages.

A standard formatter class needs a special formatter string. There are three ways to provide such a string:

  • Specifying one of the formatter strings pre-defined by a formatter class (they are called styles).
  • Using the default style of a formatter class.
  • Providing a user-defined formatter string.

Using Styles

Styles are pre-defined formatter strings, which are defined in standard formatter classes. You can specify a style via the style attribute of <ISPRINT>, or in combination with getValue().

StaticMoneyFormat

This class is used to format expression results of type Money. See the table below for valid styles. As shown in the table, the style identifier is capable of converting between the Euro currency and a predecessor currency, the Deutsche Mark, at the fixed rate of 1 Euro to 1.95583 Deutsche Mark.

Valid Style Identifier

Description

Example

MONEY_SHORT

Two digits following decimal separator. No currency symbol.

Input: 3333, Formatted string: "3,333.00"

MONEY_LONG

Two digits following decimal separator. Leading currency symbol.

Input: 3333, Formatted string: "$3,333.00"

EURO_SHORT

Currency converted into Euro. Two digits following decimal separator, included in brackets. No currency symbol.

Input: 3DM, Formatted string: "(1.53)"

EURO_LONG

Currency converted into Euro. Two digits following decimal separator, included in brackets. Leading currency symbol.

Input: 3DM, Formatted string: "(€ 1.53)"

EURO_COMBINED

Concatenation of MONEY_LONG and EURO_LONG.

Input: 3DM, Formatted string: "DM 3.00 (€ 1.53)"

DecimalFormat

This class is used to format expression results of type Number. See the table below for valid styles.

Valid Style Identifier

Description

Example

INTEGER

No digits after decimal separator. No decimal separator.

Input: 2200.1234, Formatted string: "2,200"

DECIMAL

Exactly two digits after decimal separator.

Input: 2200.1234, Formatted string: "2,200.12"

StaticQuantityFormat

This class is used to format expression results of type Quantity. See the table below for valid styles.

Valid Style Identifier

Description

Example

QUANTITY_SHORT

0 to 3 digits after decimal separator. No quantity symbol.

Input: 3333 kg, Formatted string: "3,333"
Input: 3333.1 kg, Formatted string: "3,333.1"
Input: 3333.1234 kg, Formatted string: "3,333.123"

QUANTITY_LONG

0 to 3 digits after decimal separator. Following quantity symbol.

Input: 3333 kg, Formatted string: "3,333 kg"
Input: 3333.1 kg, Formatted string: "3,333.1 kg"
Input: 3333.1234 kg, Formatted string: "3,333.123 kg"

SimpleDateFormat

This class is used to format expression results of type Date. See the table below for valid styles.

Valid Style Identifier

Description

Example

DATE_SHORT

Date without clock time in short format. Automatically displays the date in the current time zone.

Formatted string: "09/25/99"

DATE_SHORT_UTCDate without clock time in short format. Displays the date fixed in the UTC time zone.
Can be used for fixed dates that are independent of time zones, such as birthdays.
Formatted string: "09/25/99"

DATE_LONG

Date without clock time in long format. Automatically displays the date in the current time zone.

Formatted string: "SEP 25, 1999"

DATE_LONG_UTCDate without clock time in long format. Displays the date fixed in the UTC time zone.
Can be used for fixed dates that are independent of time zones, such as birthdays.
Formatted string: "SEP 25, 1999"

DATE_TIME

Clock time. Automatically displays the date in the current time zone.

Formatted string: "7:55:55 PM"

The styles listed in the following table are available for date/time input fields.

Valid Style Identifier

Description

Example

DATE_INPUT

Date without clock time.

Formatted string: "09/25/99"

TIME_INPUT

Clock time.

Formatted string: "7:55:55 PM"

DATE_TIME_INPUT

Date and clock time.

Formatted string: "9/25/99 7:55:55 PM"

MessageFormat

This class is used to format expression results of type Message. The formatter of this class cannot be customized. It has a standard behavior. For more information, see the Java documentation in <IS.INSTANCE.SHARE>/docs.

Using the Default Style of a Formatter Class

The default style of a formatter class is used if nothing else has been specified by the user, neither a style, nor a user-defined formatter style. See the table below for a list of default styles.

Standard Formatter Class

Default Style

StaticMoneyFormat

MONEY_LONG

DecimalFormat

DECIMAL

StaticQuantityFormat

QUANTITY_SHORT

SimpleDateFormat

DATE_SHORT

MessageFormat

This class has a standard behavior. For more information, see the Java documentation in <IS.INSTANCE.SHARE>/docs.

Specifying User-defined Formatter Strings

A formatter string is explicitly given by the user via the formatter attribute of <ISPRINT> or in combination with getValue(). For more information about valid placeholders, see the Java documentation in <IS.INSTANCE.SHARE>/ docs. See the table below for examples of user-defined formatter strings.

Standard Formatter Class

Example for User-Defined Formatter String

StaticMoneyFormat

Scheme: "* #,#00.0#"Input: 3, Formatted string: "$ 03.00"Input: 3333.123, Formatted string: "$ 3,333.12"

DecimalFormat

Scheme: "#,#00.0#;(-#,#00.0#)"Input: 3, Formatted string: "03.0"Input: -3333.333, Formatted string: "-3,333.33"

StaticQuantityFormat

Scheme: "#,#00.0# *;(-#,#00.0# *)"Input: 3, Formatted string: "03.0 kg"Input: 3333.333, Formatted string: "3,333.33 kg"

SimpleDateFormat

Scheme: "EEE, MMM d, ''yy", Formatted string: "Wed, Jul 10, '96"
Scheme: "h:mm a", Formatted string: "12:08 PM"
Scheme: "K:mm a, z", Formatted string: "0:00 PM, PST"
Scheme: "yyyyy.MMMMM.dd GGG hh:mm aaa", Formatted string: "1996.July.10 AD 12:08 PM"

MessageFormat

Cannot be customized.

Encoding Expression Results

It is possible to use national characters, such as Greek or Cyrillic letters, as well as mathematical symbols and any non-ASCII characters in HTML documents. To ensure that a web browser can interpret and display these characters correctly, they need to be encoded using HTML representations. In order to do this, you need to replace characters, such as "<", ">", or "&" with named character entities as defined in the HTML 4.01 standard. Because the result of an expression can be a string that might contain a special character expression, results are automatically encoded if you use <ISPRINT> to output them. See the example below, which shows the exact string returned by <ISPRINT> for a string containing a quote sign. The example assumes that the template variable product:name stores the value Nokia 447X Pro 17" Monitor.

The following ISML code in a template:

<ISPRINT value="#Product:Name#">

generates this HTML code:

"Nokia 447X Pro 17&quot; Monitor"

which is displayed by the browser as:

Nokia 447X Pro 17" Monitor

Expressions outside <ISPRINT>are never automatically encoded. In this case, if you need to encode characters, you have to use the stringToHtml() function.

Note

If you do not encode expressions outside of <ISPRINT>, then you might be vulnerable to Cross Site Scripting.

Reference - ISML Reference

Disclaimer
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.