|<xsl:for-each select=”expression” />
|The xsl:for-each element loops through each node in a node set in itsr order of occurrence and applies the same template to each node. A node set is simply the collection of all of the same XML tags (nodes) in an XML file. This process is also referred to as iterating over a set of nodes. The template is contained inside the xsl:for-each element between the opening and closing element. The syntax is:
|<xsl:for-each> code … </xsl:for-each>
|In a formal definition, the template is said to be instantiated once to each node in the node set. The default is to iterate through the nodes in the order in which they occur. This is referred to as document order. However, you may prefer to rearrange the order by using the xsl:sort element. This element defines the sort key upon which the sort (reorder) will be based.
|This element is not self-closing. The separate closing element is mandatory.
|The mandatory select attribute provides an expression that specifies which node set is to be processed by the loop. This can simply be a string that is the name of the node. Only one node set can be defined. However, by selecting a parent node, you can access the values of any child node via the template.
|You can use the position function to return the position number of the node currently being processed (the numbering starts at one). You can use the last function to return the total number of nodes being processed.