The XML code below is returning an error and I cannot find whatis causing it.
<xsl:stylesheetxmlns:xsl=”http://www.w3.org/1999/XSL/Transform”version=”1.0″>
<xsl:template match=”/”>
<HTML>
<BODY>
<P><B>This is an XML Document onView!</B></P>
<P><EM>It uses XSLSheet</EM></P>
<P>These XML documents have beenproduced</P>
<P>using only NotePad and Internet Explorerv5.0</P>
<TABLE border=”1″>
<TR>
<TD><B>Cafe Type</B></TD>
<TD><B>Cafe Name</B></TD>
<TD><B>Food</B></TD>
<TD><B>Environment</B></TD>
<TD><B>Meal Cost</B></TD>
<TD><B>Comments</B></TD>
<xsl:for-each select=”CAFES/CAFE”>
</TR>
<TR>
<TD><xsl:value-ofselect=”@CAFE_TYPE”/></TD>
<TD><xsl:value-of select=”CAFE_NAME”/></TD>
<TD><xsl:value-ofselect=”FOOD_QUALITY”/></TD
<TD><xsl:value-of select=”ENVIRON”/></TD>
<TD><xsl:value-of select=”COST_RATING”/></TD
<TD><xsl:value-ofselect=”COMMENTS”/></TD>
</TR>
</xsl:for-each
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Solution
Changes need todone:
1. Initial table row should close before starting a loop.
2. Need to close all tags properly. 3 closing tags are missingat 22, 24 and 27th line.
Correctedcode:
<xsl:stylesheetxmlns:xsl=”http://www.w3.org/1999/XSL/Transform”version=”1.0″>
<xsl:template match=”/”>
<HTML>
<BODY>
<P><B>This is an XML Document onView!</B></P>
<P><EM>It uses XSL Sheet</EM></P>
<P>These XML documents have been produced</P>
<P>using only NotePad and Internet Explorerv5.0</P>
<TABLE border=”1″>
<TR>
<TD><B>Cafe Type</B></TD>
<TD><B>Cafe Name</B></TD>
<TD><B>Food</B></TD>
<TD><B>Environment</B></TD>
<TD><B>Meal Cost</B></TD>
<TD><B>Comments</B></TD>
</TR>
<xsl:for-each select=”CAFES/CAFE”>
<TR>
<TD><xsl:value-ofselect=”@CAFE_TYPE”/></TD>
<TD><xsl:value-of select=”CAFE_NAME”/></TD>
<TD><xsl:value-ofselect=”FOOD_QUALITY”/></TD>
<TD><xsl:value-of