Newbie XSLT Transformation

wxdqz

New Member
Hi,

I've run into a snag with the following XSLT transformation

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<h2>My Groceries</h2>
<table border="1">
<thead>
<tr bgcolor="#9acd32"><th scope="col" align="left">Food Group</th><th scope="col" align="left">Item</th><th scope="col" align="left">Quantity</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="groceryList/foodGroup">
<tr><td><xsl:value-of select="groupName"/></td><td><xsl:value-of select="item/name"/></td><td><xsl:value-of select="item/howMuch"/></td></tr>
</xsl:for-each>

</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


The goal is to output each item, quantity of the following:
<!-- m --><a class="postlink" href="http://bushidodeep.com/exercises/xmlphp/groceries/groceries.xml">http://bushidodeep.com/exercises/xmlphp ... ceries.xml</a><!-- m -->
in a cell next to each foodgroup.

This is what is returned so far:

<html>
<body>
<h2>My Groceries</h2>
<table border="1">
<thead>
<tr bgcolor="#9acd32">
<th align="left" scope="col">Food Group</th><th align="left" scope="col">Item</th><th align="left" scope="col">Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Fruits and Vegetables</td><td>Pomegranate</td><td>2</td>
</tr>
<tr>
<td>Grains</td><td>Couscous</td><td>6 ounces</td>
</tr>
<tr>
<td>Candy</td><td>Crunchie Bar</td><td>1 gross</td>
</tr>
</tbody>
</table>
</body>
</html>


What am I missing? As this is my first post, please inform if any additional information/formatting is perferred.
 
Back
Top