Next / Previous / Contents / Shipman's homepage

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>