With xsl:for-each
, the template to use is fixed. It is the template that is contained in the body of the xsl:for-each
element. With xsl:apply-templates
, the XSLT processor finds the template to be used for each selected node by matching that node against the template rules in the stylesheet.