Next / Previous / Contents / TCC Help System / NM Tech homepage

10. Branching elements

The elements described in this section all you to iterate over a set of nodes, and also to provide processing that happens only in certain cases.

10.1. <xsl:for-each>: Iterate over a set of nodes

To do the same thing to each node in a node set, use the <xsl:for-each> construct. Stuff inside this element gets done once for each element in the node-set. There is one attribute:

select (required)

An XPath expression that specifies the node-set over which you want to iterate.

For example, suppose you are writing a template with child elements of types <daughter> and <son>. This element would process all the children of either type:

    <xsl:for-each select="daughter|son">...</xsl:for-each>