Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

var

date_range 13-Jan-21

Syntax

content_copy zoom_out_map
var $name=value;

Description

Declare a local or global variable. A variable is global if it is defined outside of any template. Otherwise, it is local. The value of a global variable is accessible anywhere in the style sheet. The scope of a local variable is limited to the template or code block in which it is defined. Variables declared in this manner are immutable. You initialize a variable by following the variable name with an equal sign (=) and an expression.

Attributes

name

Specifies the name of the variable. After declaration, the variable can be referred to within expressions using this name, including the $ character.

value

Defines the default value for the variable, which is used if the person or client application that executes the script does not explicitly provide a value.

SLAX Example

content_copy zoom_out_map
var $vrf;
var $location = $dot/@location;
var $message = "We are in "_ $location _" now.";

XSLT Equivalent

content_copy zoom_out_map
<xsl:variable name="vrf"/>
<xsl:variable name="location" select="$dot/location"/>
<xsl:variable name="message" select="concat('We are in ', $location, now.')"/>

Release Information

Statement introduced in version 1.0 of the SLAX language.

footer-navigation