I'm having trouble getting my XSL to 'style' my XML properly. Firefox loads the XSL file, but doesn't apply the variables properly. IE doesn't even load the XSL - just gives me it's rendering of the XML document.
A sampling of the XML document:
Code: Select all
<?xml version = "1.0" encoding = "ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href = "https://path/to/my/xsl/file" ?>
<picker>
<square>
<row>
<colour red = "00" green = "ff" blue = "ff">
</colour>
<colour red = "00" green = "ff" blue = "ee">
</colour>
<colour red = "00" green = "ff" blue = "dd">
</colour>
<colour red = "00" green = "ff" blue = "cc">
</colour>
</row>
</square>
</picker>Code: Select all
<table>
<tr>
<td class = 'colourCell' style = "background-color:#00ffff;">
</td>
<td class = 'colourCell' style = "background-color:#00ffee;">
</td>
<td class = 'colourCell' style = "background-color:#00ffdd;">
</td>
<td class = 'colourCell' style = "background-color:#00ffcc;">
</td>
</tr>
</table>Code: Select all
<table>
<tr>
<td class = 'colourCell' style = "">
</td>
<td class = 'colourCell' style = "">
</td>
<td class = 'colourCell' style = "">
</td>
<td class = 'colourCell' style = "">
</td>
</tr>
</table>Code: Select all
<?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='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="/">
...
<body>
<div style = "font-size:5pt;" onmouseover = 'showColour(event);' onclick = 'setColour(event);'>
<xsl:for-each select="picker/square">
<table cellspacing = "0" cellpadding = "0" border = "0" style = "display:inline;">
<xsl:for-each select = "row">
<tr>
<xsl:apply-templates />
</tr>
</xsl:for-each>
</table>
<xsl:if test="@newline='true'">
<br />
</xsl:if>
</xsl:for-each>
<div style = "border:1px solid #333;height:32px;width:152px;padding:3px;">
<div id = "well" style = "font-family:Verdana,sans-serif;font-size:8pt;height:32px;width:152px;">
</div>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="colour">
<xsl:variable name="loopRed" select="@red" />
<xsl:variable name="loopGreen" select="@green" />
<xsl:variable name="loopBlue" select="@blue" />
<td>
<xsl:attribute name = "style">
<xsl:text>
background-color:#
</xsl:text>
<xsl:value-of select="$loopRed" />
<xsl:value-of select="$loopGreen" />
<xsl:value-of select="$loopBlue" />
</xsl:attribute>
<xsl:attribute name = "class">
<xsl:text>
colourCell
</xsl:text>
</xsl:attribute>
</td>
</xsl:template>
</xsl:stylesheet>