Separator attribute on xsl:for-each and xsl:apply-templates

If syntax extensions are enabled, then the xsl:for-each and xsl:apply-templates instructions allow a separator attribute, similar to the separator attribute on xsl:value-of.

The effect of the attribute is as follows. The attribute value template is expanded, once, using the outer context. The resulting string is converted to a text node. This text node is added to the result sequence after processing every item in the (sorted) input sequence, except the last.

For example, <xsl:apply-templates select="item" separator=", "/> inserts a comma and space into the output after processing every item element in the input sequence, except the last