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. Each of the nodes is then processed by the instructions contained in the for-each statement.

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.