Supported Platforms
Related Documentation
- ACX, EX, M, MX, SRX, T Series
- SLAX Parameters Overview
- ACX, EX, M, MX, PTX, SRX, T Series
- SLAX Templates Overview
- apply-templates
- call
- match
- mode
- priority
- template
with
Syntax
with $name = value;
Release Information
Statement introduced in version 1.0 of the SLAX language.
Description
Specify a parameter to pass into a template. You can use this statement when you apply templates with the apply-templates statement or invoke templates with the call statement.
Optionally, you can specify a value for the parameter by including an equal sign (=) and a value expression. If no value is specified, the current value of the parameter is passed to the template.
Attributes
name | — | Name of the variable or parameter for which the value is being passed. |
value | — | Value of the parameter being passed to the template. |
SLAX Example
match configuration {
var $domain = domain-name;
apply-templates system/host-name {
with $message = "Invalid host-name";
with $domain;
}
}
match host-name {
param $message = "Error";
param $domain;
<hello> $message _ ":: " _ . _ " (" _ $domain _ ")";
}
XSLT Equivalent
<xsl:template match="configuration">
<xsl:apply-templates select="system/host-name">
<xsl:with-param name="message" select="'Invalid host-name'"/>
<xsl:with-param name="domain" select="$domain"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="host-name">
<xsl:param name="message" select="'Error'"/>
<xsl:param name="domain"/>
<hello>
<xsl:value-of select="concat($message, ':: ', ., ' (', $domain, ')')"/>
</hello>
</xsl:template>
Usage Examples
See Example: Configuring Dual Routing Engines, Example: Preventing Import of the Full Routing Table, and Example: Automatically Configuring Logical Interfaces and IP Addresses.
Related Documentation
- ACX, EX, M, MX, SRX, T Series
- SLAX Parameters Overview
- ACX, EX, M, MX, PTX, SRX, T Series
- SLAX Templates Overview
- apply-templates
- call
- match
- mode
- priority
- template
Published: 2013-03-05
Supported Platforms
Related Documentation
- ACX, EX, M, MX, SRX, T Series
- SLAX Parameters Overview
- ACX, EX, M, MX, PTX, SRX, T Series
- SLAX Templates Overview
- apply-templates
- call
- match
- mode
- priority
- template