[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

mod position() tests positive all of the time

Subject: mod position() tests positive all of the time
From: "Allen Jones" <jonesa@xxxxxxxxxxxxx>
Date: Sat, 30 Dec 2006 07:06:32 -0500
 mod position() tests positive all of the time
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.