value-of << for-each >> Output Filtering
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.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template match="/">


<table border="1">
<xsl:for-each select="list_of_movies/movie">
<td> <xsl:value-of select="title"/> </td>
<td> <xsl:value-of select="age_group"/> </td>
<td> <xsl:value-of select="comments"/> </td>



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
value-of << for-each >> Output Filtering

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads