help with XPath
Below is a snippet of XSL that I'm working on. I am getting a list of files from an SQL database, and I'd like to display them in a table 4 columns wide. Trouble is, I can't predict how many items I will get, so I'm trying to use the position() function to insert a new row tag after every 4 files.
<TABLE Class="Files">
<xsl:variable name="columns" select="4"/>
<xsl:if test="position() mod $columns = 0">
<xsl:for-each select="TABLE/COLUMN">
<xsl:value-of select="position() mod $columns"/>
<TR>
CODE TO START NEW ROW AND DISPLAY FILE
</TR>
</xsl:if>
<xsl:if test="position() mod $columns > 0">
CODE TO DISPLAY FILE WITHOUT NEW ROW
</xsl:if>
</TABLE>
I have added a line to display the value of "position() mod $columns = 0" within the for-each, so I can see that I am getting correct values (1, 2, 3, 0, 1, 2, 3, 0). The problem is, even when the calculation =zero, the xsl:if (bold above) NEVER evaluates to true. Is this a bug with MSXML3?
Any help is appreciated.
Ken
|