with
Syntax
with name = value;
Description
Specify a variable or parameter to be passed into a template. You can use this statement when you apply templates with the apply-templates statement or call templates with the match statement.
Optionally, you can specify a value for the parameter by including an equal sign (=) and a value expression. If no value is given, the current value of the variable or parameter is passed.
name—Name of the variable or parameter for which the value is being passed.
value—Value of the parameter being passed to the template.
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 _ ")";
}<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>
See Example: Configuring Dual Routing Engines, Example: Preventing Import of the Full Routing Table, and Example: Automatically Configuring Logical Interfaces and IP Addresses.
Hide Navigation Pane
Show Navigation Pane
Download
SHA1