The <xsl:for-each> Element
The <xsl:for-each> element enables you to loop over a template body, over and over, for all elements of a node set. Technically speaking, it works on a node set returned by an XPath expression, and performs the same operation on each node in the set. Each time you loop over the template body, it’s applied to the next node from the node set, making it easy to handle multiple nodes.
<xsl:for-each>Versus <xsl:apply-templates>You might have noticed that this description is a lot like the one for the <xsl:apply-templates> element, and I’ll compare <xsl:for-each> and <xsl:apply-templates> in a few pages. |
The <xsl:for-each> element has one attribute:
select(mandatory). Set to an XPath expression that returns the node set ...
Get Inside XSLT now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.