Short Description

outputs the results of ISML expressions and template variables

Table of Contents

Product Version


Product To Version



1 Introduction

<ISPRINT> outputs the results of ISML expressions and template variables. Even though it is possible to output expression results without <ISPRINT>, you should always use it, because it contributes to optimizing your template code.

The <ISPRINT> tag does the following:

  • automatically formats the output string
    When printing expression results using <ISPRINT>, the output is formatted according to its type by an appropriate formatter class. For more information about formatter classes, see Formatting Expression Results. You can use three
    formatter strings to control the output format:
    • The default formatter string of the formatter class.
    • One of the pre-defined formatter strings (styles) of the formatter class.
    • A formatter string that you have defined.
  • automatically encodes the output string

<ISPRINT> automatically encodes the result of expressions and the contents of ISML variables, except for user-defined variables and string constants. During the encoding any special characters, such as ;, <, >, &, ="=, including any named characters of HTML 4.01 (Unicode 160-255) are converted into their HTML counterparts. For example, the character > would be converted into the string &gt;.

For more information, see Encoding Expression Results.


The encoding is always done after the formatting.

The following example shows a string containing quotation marks, and the corresponding string that is returned by the <ISPRINT> tag (it is assumed that the template variable product:name has the value 'Nokia 447X Pro 17" Monitor'):

The ISML code in the template is:

<ISPRINT value="product:name">

The HTML code generated is:

Nokia 447X Pro 17&quot; Monitor

And the browser will render this text as:
Nokia 447X Pro 17" Monitor

Expressions outside <ISPRINT> tags are not automatically encoded. In this case, special characters must be converted with the stringToHtml() function.

2 Syntax

  [ encoding = "( on | off )" ]
    value = "{ISML expression}"
  [ style = "{Style Identifier}"] |
  [ formatter = "{Format String}"]
  [ symbols = "( {Symbol Declaration} | {ISML expression} )" ]
  [ padding = "( {Padding Constant} | {ISML expression} )" ]

3 Example

The first example demonstrates how to use <ISPRINT> to output an expression that returns a string. The returned string is formatted as defined by either the default formatter (line one), or by using a style (line two), or by a user-defined formatter string (line three).

<ISPRINT value = "#Basket:Offering:Price#">
<ISPRINT value = "#Basket:Offering:Price#" style = "EURO_LONG">
<ISPRINT value = "#Basket:Offering:Price#" formatter = "* #00.0#">

The usage of the symbols attribute:

<isprint value="#aNumber#" formatter="#.#" symbols="GroupingSeparator=';DecimalSeparator=,">
<isprint value="#aDate#" formatter="h:mm a" symbols="AmPmStrings={ante meridiem, post meridiem}">

The usage of the padding attribute:

<ISPRINT value = "#Product:Price#" padding = "-10"> //string output: " 5.00 EUR"
<ISPRINT value = "#Product:Price#" padding = "+10"> //string output: "5.00 EUR"
<ISPRINT value = "#'foolish'#" padding = "+3"> //string output: "foo"

The usage of the encoding attribute:

<ISPRINT value = "#'>new<'#" encoding = "on"> //string output: ">new<"
<ISPRINT value = "#'>new<'#" encoding = "off"> //string output: ">new<"

4 Attributes

4.1 value

This attribute is required.
value = ISML Expression
Specifies the expression you want to output with <ISPRINT>.

4.2 encoding

This attribute is optional.
encoding = on | off | encoding handler
Default value is on. With this attribute, you can explicitly switch automatic encoding on and off. Intershop 7 supports encoding in HTML, XML and WML. Even if encoding is turned off, the functions stringToHtml(), stringToXml() and stringToWml() can be used to encode individual strings.
For more details on how to use encoding types supported by Intershop or add a custom encoding type see: Cookbook - Encoding.

4.3 style

This attribute is optional.
style = style identifier
Use this attribute to specify a style identifier. See Formatting Expression Results, for a list of valid style identifiers. Instead of using the style attribute, you can alternatively define a formatter string using the formatter attribute.

4.4 formatter

This attribute is optional.
formatter = string
Use this attribute to define a formatter string to control how <ISPRINT> outputs your expression's result. For information on building your own formatter string, refer to Formatting Expression Results. If formatter is used, style must be omitted.

4.5 symbols

This attribute is optional.
symbols = symbol declaration
Use this attribute to modify the format used for printing. The value of the symbols attribute can be a symbol declaration or an ISML expression that results in a symbol declaration. This attribute supports all properties of
the types char, String and String of java.text.DecimalFormatSymbols and java.text.DateFormatSymbols.

For symbol declarations, the following syntax is allowed:

<SymbolsDecl> ::= <SymbolDecl> ( ';' <SymbolDecl> )*
<SymbolDecl> ::= <SymbolName> '=' <ValueDecl>
<ValueDecl> ::= <Value> | <ValueList>
<ValueList> ::= '{' <Value> ( ',' <Value> )* '}'


The values can contain escaped characters. Use a \ for escaping.

4.6 padding

This attribute is optional.
padding = padding constant
This is used only with mail templates, namely templates using plain rather than HTML type, to define field width and other spacing issues.

For example, when printing a list of product names using a loop statement, you can define a constant field width for every element of the list. The value for padding can be any positive or negative number. The absolute value of padding constant defines the field width. A positive value produces left-aligned output, a negative value produces right-aligned output. If the output string is greater than the field size, the output string will be truncated at its right end.

Reference - ISML Tags


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.

Customer Support
Knowledge Base
Product Resources
Support Tickets