[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] for-each n number of times, multiple times


Subject: Re: [xsl] for-each n number of times, multiple times
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 23 Aug 2005 16:18:33 +0100

> the current version of the xsl gives me the first group of 
> sixty on one page, but I cannot figure out how to process the rest, sixty at 
> a time.  Any help would be greatly appreciated.

process every 60'th item, and for each one make a page by processing
that one and its 59 following siblings

so in general:

<xsl:for-each select="item[position() mod 60 = 1]">
  <page>
<xsl:apply-templates select=".|following-sibling::item[position()&lt;60]"/>
  </page>
</xsl:for-each>

  <!--          <xsl:for-each select="//TRANSACTION/PAYMENT[ position() mod 
60 = 1 ]">    -->

Don't use // it means "spend ages searching the entire document to
arbitrary depth, looking for TRANSACTION elements.

/PAYMENT[ position() mod 60 = 1 ]

in a step position() counts items in that step, so this is just counting
PAYMENT within this TRANSACTION, and probably there is only one of those
per transaction.

So you want exactly teh "general" form above, with item replaced by
TRANSACTION.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords
xsl