This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: counter


Dave,

>I'm trying to split a huge table of items into several pages.  I'd like to
>have a page header, the 50 items, then a page footer consisting of the
>current page and total number of pages, followed by the next page of items,
>with it's own header and footer.

As long as it's as simple as this, you could count the total number of
items, divide by 50 and 'ceiling' the result to get the number of pages.
If your 'item' elements were all within a 'list', for example:

<xsl:template match="list">
  Number of pages: <xsl:value-of select="ceiling(count(item) div 50)" />
</xsl:template>

>Would the XML document have to be parsed twice to obtain the total number of
>pages?

The XML document doesn't have to be parsed twice, but you might have to
process the output of your page-creating stylesheet with a page-numbering
stylesheet (say) if you can't work out the number of pages that there are
going to be a priori from the original XML document that you have.  If your
algorithm for creating pages is fairly simple, as above, then you there's
no need.

I hope that helps,

Jeni

Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 • Fax 0115 9061304 • Email
jeni.tennison@epistemics.co.uk



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]