Subject: Re: [xsl] Need exactly 23 rows of output before next page From: Clay Leeds <cleeds@xxxxxxxxxx> Date: Fri, 13 Aug 2004 10:57:44 -0700 |
Clay Leeds wrote:I am re-creating a medical form which outputs exactly 23 rows per page (i.e., if there are 3 rows of data, 23 nodes are output; if there are 24 rows of data, 46 nodes are output, w page one having 23 rows of data, and page 2 having one row of data filled/22 rows empty, etc.).
Uhh, requirements straight out of hell...
You can compute the number of rows necessary to make the total number a multiple of 26 using the mod operator, and fill the missing rows using the wendell-piez-method or a recursive template:
<xsl:for-each select="DETAILLINE">
<fo:table-row height=".8cm" border=".5pt solid {$varColor}"
border-collapse="collapse" line-height="22pt">
<fo:table-cell text-align="center" border-bottom=".5pt solid {$varColor}">
<fo:block>
<xsl:value-of select="DOSFROM/MM"/>
</fo:block>
</fo:table-cell>
..
</fo:table-row>
</xsl:for-each>
<xsl:variable name="detail-count" select="count(DETAILLINE)"/>
<xsl:if test="($detail-count mod 23) != 0">
<xsl:for-each select="//node()[position() <
(24 - ($detail-count mod 23))]">
... add empty rows ...
</xsl:for-each>
</xsl:if>
<xsl:for-each select="//node()[position() < (24 - ($detail-count mod 23))]">
There should be multiple alternative, possibly more elegant and/or correct formulations of the solution. If performance is bad, switch to a recursive template (the XSLT FAQ has it all).
J.Pietschmann
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Need exactly 23 rows of o, J.Pietschmann | Thread | Re: [xsl] Need exactly 23 rows of o, J.Pietschmann |
Re: [xsl] grouping + global variabl, Bruce D'Arcus | Date | Re: [xsl] Can't get output from xml, Todd Alexander |
Month |