expr
Syntax
expr expression;
Release Information
Statement introduced in version 1.0 of the SLAX language.
Description
Generate the string value of an XPath expression and add it to the result tree. The XPath expression might consist of a function call, a location path, a literal number, or a string. SLAX-specific operators are permitted. This statement cannot be used at the top-level of a script. It can only appear within a code block. By default, characters such as "<", ">", and "&" are escaped into proper XML as "<", ">", and "&", respectively.
The expr
statement is most commonly
used to invoke functions that return no results, for conditional variable
assignment, and to return text content from a template.
Attributes
expression
—XPath expression to evaluate. The resulting
string is added to the result tree.SLAX Example
expr "Test: "; expr substring-before(name, "."); expr status; expr jcs:output("Test");
XSLT Equivalent
<xsl:text>Test: </xsl:text> <xsl:value-of select="substring-before(name, '.')"/> <xsl:value-of select="status"/> <xsl:value-of select="jcs:output('Test')"/>