Hi,
I hope you will find someway using the following xslt in order to get
page breaks based on the date condition...
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match='data'>
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="*">
<xsl:variable name="currentdate"><xsl:value-of
select="date"/></xsl:variable>
<xsl:variable name="previousdate"><xsl:value-of
select="preceding-sibling::record/date"/></xsl:variable>
<xsl:if test="$currentdate!=$previousdate">
<fo:block break-after="page"/>
</xsl:if>
<fo:block>
<xsl:value-of select="$currentdate"/>
<xsl:value-of select="$previousdate"/>
</fo:block>
<fo:block>
<xsl:value-of select="name"/>
</fo:block>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
I don't know this may be the ideal solution or not?
Cheers,
Venkat.
shrutin wrote:
Hello All,
I am new to FOP and have started my first assignment. i need to know how can
i insert a page break on the basis of a condition.
Scenario:
I have a list and based on the value in the list i need to break pages.
i.e my XML data is
<data>
<record>
<date>01/01/2009</date>
<srno>A</srno>
<name>AA</name>
</record>
<record>
<date>01/01/2009</date>
<srno>A</srno>
<name>AA</name>
</record>
<record>
<date>02/01/2009</date>
<srno>A</srno>
<name>AA</name>
</record>
</data>
Now my XSL has a <xsl:for-each> statement for iterating the list into a
table. But what i need is that the as the date changes a page break should
be inserted.
i.e. In the above example the first 2 records should be on page 1 and then a
page break should be inserted enabling the 3rd record to be on another page.
How could i do this?
Awaiting replies.
Thanks
Shruti
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org