[xsl] mod position() tests positive all of the time

Subject: [xsl] mod position() tests positive all of the time
From: "Allen Jones" <jonesa@xxxxxxxxxxxxx>
Date: Sat, 30 Dec 2006 07:06:32 -0500
I am new to the list, but I have checked the archive for this particular
problem and I haven't been able to find a solution to this.

I am using the following stylesheet and everytime it tests for position,
the results always print the <tr> (rather than printing every 5th
element). Since I am new to XSLT, I know it is probably in the code. 
Any help would be a lesson.

Allen Jones

<?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" encoding="iso-8859-1"/>
<xsl:template match="/">
<html>
      <body >
<xsl:call-template name="results"/>
      </body>
    </html>
</xsl:template>

<xsl:template name="results">
<table>
<xsl:for-each
select="insightResponse/searchResponse/collectionResultSet/object/thumbnail[position()
mod 5 = 1]">
<tr>
<xsl:apply-templates select=". | following-sibling::thumbnail[position()
&lt; 5]" />
</tr>
</xsl:for-each>
</table>
</xsl:template>

<xsl:template match="thumbnail">
<td align="center"><img src="{@URL}" /><br />
<xsl:for-each select="label"><xsl:value-of select="."/><br
/></xsl:for-each>
</td>
</xsl:template> 
</xsl:stylesheet>



Allen Jones
Director - Digital Library Programs
University Library - New School
55 West13th Street, room 905
New York, NY 10011
(voice) 212.229.5309 x4502
(fax) 212.675.7361

Current Thread