for-each
Syntax
for-each (expression) {
/* code */
}Description
Include a looping mechanism that repeats script processing for each instance of identical XML elements. The element nodes are selected by the expression attribute. The instructions contained in the for-each statement processes each of the nodes.
The statement consists of the for-each keyword, the parentheses-delimited expression, and a curly braces-delimited block. The SLAX for-each statement functions like the <xsl:for-each> element.
expression—Selects the nodes to which the processor applies templates. By default, the processor applies templates to the child nodes of the current node.
for-each ($inventory/chassis/chassis-module/
chassis-sub-module[part-number == '750-000610']) {
<message> "Down rev PIC in " _ ../name _ ", " _ name _ ": " _ description;
}
<xsl:for-each select="$inventory/chassis/chassis-module/
chassis-sub-module[part-number == '750-000610']">
<message>
<xsl:value-of select="concat('Down rev PIC in ', ../name, ', ', name, ': ',
description)"/>
</message>
</xsl:for-each>
See Example: Requiring and Restricting Configuration Statements, Example: Imposing a Minimum MTU Setting, Example: Limiting the Number of E1 Interfaces, Example: Adding T1 Interfaces to a RIP Group, Example: Configuring Administrative Groups for LSPs, and Example: Configuring Dual Routing Engines.
Hide Navigation Pane
Show Navigation Pane
Download
SHA1