xsl-list
[Top] [All Lists]

Re: [xsl] Multi page pdf using fop-one page for each person tag

2008-04-04 03:47:02
At 2008-04-04 11:01 +0100, Khan, Atique \(IT\) wrote:
I need to convert my xml data using xsl-fo template into pdf using fop.
My XML data looks like

<resultset>
    <person>
    ...
    </person>
    <person>
    ...
    </person>
    <person>
    ...
    </person>
    .
    .
</resultset>

Each of the person tags need to go into a separate page in the pdf. Can
somebody please guide me with a sample xsl-fo template.

I hope this helps.

. . . . . . . . . Ken

T:\ftemp>type khan.xml
<resultset>
    <person>
    ...
    </person>
    <person>
    ...
    </person>
    <person>
    ...
    </person>
</resultset>

T:\ftemp>type khan.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns="http://www.w3.org/1999/XSL/Format";
                version="2.0">

<xsl:output indent="yes"/>

<xsl:template match="/">
<root font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>
  <xsl:apply-templates/>
</root>
</xsl:template>

<xsl:template match="person">
  <page-sequence master-reference="frame">
    <flow flow-name="frame-body">
      <block>This is a person</block>
    </flow>
  </page-sequence>
</xsl:template>

</xsl:stylesheet>
T:\ftemp>xslt2 khan.xml khan.xsl khan.fo

T:\ftemp>type khan.fo
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.w3.org/1999/XSL/Format"; font-family="Times" font-size="2
0pt">
   <layout-master-set>
<simple-page-master master-name="frame" page-height="297mm" page-width="21
0mm" margin-top="15mm"
                          margin-bottom="15mm"
                          margin-left="15mm"
                          margin-right="15mm">
         <region-body region-name="frame-body"/>
      </simple-page-master>
   </layout-master-set>
    <page-sequence master-reference="frame">
      <flow flow-name="frame-body">
         <block>This is a person</block>
      </flow>
   </page-sequence>
    <page-sequence master-reference="frame">
      <flow flow-name="frame-body">
         <block>This is a person</block>
      </flow>
   </page-sequence>
    <page-sequence master-reference="frame">
      <flow flow-name="frame-body">
         <block>This is a person</block>
      </flow>
   </page-sequence>
</root>
T:\ftemp>

--
Upcoming:  UBL Apr.22,24; genericode code lists Apr.23; Rome,Italy
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>