Here's an XML stylesheet (festoon taggery to taste):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="[link|http://www.w3.org/1999/XSL/Transform|http://www.w3.org/1999/XSL/Transform]"><xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="recordset/record">
<tr>
<td><xsl:value-of select="field1" /></td>
<td><xsl:value-of select="field2" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
But you'll need to feed it an XML document. Generate one thusly (thanks FuManChu)(4 lines in for-loop should of course be indented):
output = ['<?xml version="1.0" encoding="ISO-8859-1"?>']
output.append("<recordset>")
for record in recordset:
output.append("<record>")
output.append("<field1>%s</field1>" % field1)
output.append("<field2>%s</field2>" % field2)
output.append("</record>")
output.append("</recordset>")
print "\\n".join(output)
For bonus IE-only points, you can apply the stylesheet at runtime with this:
<html>
<body><script type="text/javascript">// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("recordset.xml")
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("stylesheet.xsl")
document.write(xml.transformNode(xsl))</script>
</body>
</html>
;)