I have noticed an annoying difference between Firefox 1.0.7 and IE 6.0 with regards to the XPath position() function.
The return value of the position() function is displayed in the first column that is generated by the xml/xsl. When rendering the file foo.xml (see below) in IE this column displays 1 in row 1 and 2 in row 2 whereas in Firefox it contains 2 in row 1 and 4 in row 2. Am I doing something silly or is this a known Firefox bug?
[u]foo.xml</u>
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="foo.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
</cd>
</catalog>
[u]foo.xls</u>
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="catalog">
<table border="0" cellpadding="2" cellspacing="2">
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="cd">
<tr>
<td><xsl:value-of select="position()"/></td>
<xsl:for-each select="descendant::*">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>