Forum Moderators: open

Message Too Old, No Replies

Problem w/ XSLT in IE

Problem with HTML table w/ XSLT in IE

         

Syntax Error

8:19 pm on Jul 1, 2005 (gmt 0)

10+ Year Member



I have an XML file and an accompanying XSLT file. The section of XSLT that I'm having a problem with is supposed to generate an HTML table, with a font tag wrapped around it, with the size, color, and face attributes in that font tag coming from the formatting section of the XML file. When opened in Fire Fox, this section of code works as expected, but in IE the color of the font is not used from the xml file; therefore it shows up as the default black color.


<font size="{review/format/text/@size}" face="{review/format/text/@font}" color="{review/format/text/@color}">
<table colspan="3px">
<xsl:for-each select="review/specs/spec">
<tr>
<td><b><xsl:value-of select="@name"/>:</b></td>
<td align="right"><xsl:value-of select="@value"/></td>
</tr>
</xsl:for-each>
</table>
<br/>

Any ideas on how to fix this? Thanks.

choster

4:26 pm on Jul 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

It looks to me like a rendering question, not an XSL problem-- IE is not applying your <font> styles to <table> contents. But in this day and age there's no good reason to use <font> in the first place.

<table colspan="3px">

This doesn't make any sense either. The colspan attribute is only valid on <td> or <th>, and would be a whole number, not a pixel value, and even then you only have two columns, not three.

Maybe you could replace the font definition with something like

<style type="text/css">
<xsl:value-of select="concat('td {color: ',review/format/text/@color,'; font-family: ', review/format/text/@font,';}')" />
</style>

Or perhaps better, @import external stylesheets which control the visual display. Or if you have a set number of color/typeface/size combinations, you could output a class or id to the table as might be appropriate, defined in a single external stylesheet.