Tuesday, April 17, 2012

Conditionally Limiting Rows on a Page

For those of you new to xpath or xsl, position() is the current position in a for-each loop. For each iteration the position is incremented by one automatically. Typically, position does not need to be used in most Xpath operations.

Modulus (mod) is a basic mathematical function that divides a number and returns the reminder. It's usefullness is not strictly limited to mathematical applications. As an example, if you have ever written program that creates a Gregorian calendar you have used modulus. Anyways, it's also a valuable function in bip as we will see shortly.

Pseudo Code Solution
If position() mod 15 = 0 then
  Use bip section break
End if

BIP Solution
All we have to do is test if the position is divisible by 15, if it's not then we do nothing, otherwise, we do a page-break.

NOTE:
In some cases standard page breaks doesn't work in grouping, use XSL page break in form field

<xsl:attribute name="break-before" > page</xsl:attribute>


Sample Files:
XML: EmployeeListing.xml
RTF: SectionBreak-PageBreakbyNum.rtf
Source=>http://bipublisher.blogspot.com/2009/06/bi-publisher-conditionally-limiting.html
Related Posts Plugin for WordPress, Blogger...