Loops

xsl:for-each

<xsl:for-each select="..." [order-by="+ element_name"]>
...
</xsl:for-each>
  • Loops through each node
  • The value of the select attribute is an XPath expression
<xsl:for-each select="catalog/cd[artist='Bob Dylan']">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
<xsl:for-each select="catalog/cd" order-by="+ artist">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>