Ok, so far a single entry can be viewed through the XSL template using the value-of command. The next step is to use the for-each command to loop through all of the groups found in the XML file.
The first effect the for-each command does is create a loop. It will go through each of the "nodes" to extract the information. The second effect is in the select value. It creates a base path so your value-of commands just have to show the actual tag reference instead of the full path.
Since the for-each loop is around the TR tags, it will create a new Table Row for each loop it does.
You can now view the XML page... XML Example 6
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="list_of_movies/movie">
<tr>
<td> <xsl:value-of select="title"/> </td>
<td> <xsl:value-of select="age_group"/> </td>
<td> <xsl:value-of select="comments"/> </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="list_of_movies/movie">
<tr>
<td> <xsl:value-of select="title"/> </td>
<td> <xsl:value-of select="age_group"/> </td>
<td> <xsl:value-of select="comments"/> </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The first effect the for-each command does is create a loop. It will go through each of the "nodes" to extract the information. The second effect is in the select value. It creates a base path so your value-of commands just have to show the actual tag reference instead of the full path.
Since the for-each loop is around the TR tags, it will create a new Table Row for each loop it does.
You can now view the XML page... XML Example 6

