XSLT TutorialLesson 57Free preview
XSLT <for-each>
This lesson is part of XML · All levels
Summary
<xsl:for-each> repeats the output block for each node in the select expression result node-set. Within the block you are free to use <xsl:value-of>, <xsl:if>, or other elements to format each item. The iteration sequence follows the document sequence, unless changed by <xsl:sort>.
Key points
- Select attributes determine which nodes to repeat
- The iterative order is the document order.
- Position() returns the current iteration number, starting with 1
- Last() returns the total number of nodes in the node-set
- <xsl:sort> as a child for-each changing the order of iteration
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.