You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ahmed Haddad <ah...@carturis.fr> on 2007/07/31 01:04:49 UTC
RE: About page sequences => Page sequences do not alternate?
I have the same problem as Richard. On the web all examples I found do use
".fo" files with static contents.
To simplify, I will try to explain my problem usin the same example as
Richard (may be we will have our solutions in the same time?!):
<all_invoices>
<client name="client1">
<letter ref_let="letter1">
</letter>
<invoices>
<invoice ref_inv="inv1"></invoice>
</invoices>
</client>
<client name="client2">
<letter ref_let ="letter2">
</letter>
<invoices>
<invoice ref_inv="inv2"></invoice>
<invoice ref_inv="inv3"></invoice>
</invoices>
</client>
</all_invoices>
1* I have tried to use two simple page master:
<fo:simple-page-master master-name="letter" ...
<fo:region-body margin-top="0cm" margin-bottom="0cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="invoice" ...
<fo:region-body margin-top="9.1cm" margin-bottom="0.5cm"/>
<fo:region-before extent="9cm" />
</fo:simple-page-master>
2** Then I defined a <fo:page-sequence-master> to be able to alternate these
page masters:
<fo:page-sequence-master master-name="alternating">
<fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
<fo:conditional-page-master-reference master-reference="letter"
page-position="first"/>
<fo:conditional-page-master-reference master-reference="invoice"
page-position="rest"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
3*** Page sequences:
<fo:page-sequence master-reference="letter">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates select="
all_invoices/client/letter"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="type-crg">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
<xsl:call-template name="invoice-header"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates select="
all_invoices/client/invoices/invoice"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
==> RESULTING PDF: I have all letters for all clients, and then all
invoices!! No alternating page masters.
What is the right xsl-fo transformation to have per client: the letter and
then all his invoices??
Thanx for any help.
-----Message d'origine-----
De : J.Pietschmann [mailto:j3322ptm@yahoo.de]
Envoyé : lundi 30 juillet 2007 23:11
À : fop-users@xmlgraphics.apache.org
Objet : Re: About page sequences
Richard FARAND wrote:
> I have to print a set of clients' invoices. For each client I have to
> print a letter first, and then print all his invoices.
> So I have an XML File with structure like this:
[snip]
> Which page-sequence (conditional or not), should I use to print for each
> client, his letter in the right page-master and then all his invoices in
> the second one.
Please clarify whether you need help writing the FO or whether you
need help writing the transformation from your XML source to the FO.
In the latter case, you'll get help more easily on the XSL list:
http://www.mulberrytech.com/xsl/xsl-list/
There are several examples for FO documents using multiple page masters
in the FOP distribution, for example
examples/fo/pagination/franklin_2pageseqs.fo
You can find more on the internet, in particular in Dave Pawson's XSL
FAQ.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: About page sequences => Page sequences do not alternate?
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Ahmed Haddad wrote:
> I have the same problem as Richard. On the web all examples I found do use
> ".fo" files with static contents.
[snip]
> 1* I have tried to use two simple page master:
> <fo:simple-page-master master-name="letter" ...
> <fo:region-body margin-top="0cm" margin-bottom="0cm"/>
> </fo:simple-page-master>
>
> <fo:simple-page-master master-name="invoice" ...
> <fo:region-body margin-top="9.1cm" margin-bottom="0.5cm"/>
> <fo:region-before extent="9cm" />
> </fo:simple-page-master>
>
> 2** Then I defined a <fo:page-sequence-master> to be able to alternate these
> page masters:
I don't think you have to define a page sequence master for your
requirements.
[snip]
> 3*** Page sequences:
> <fo:page-sequence master-reference="letter">
> <fo:flow flow-name="xsl-region-body">
> <fo:block>
> <xsl:apply-templates select="
> all_invoices/client/letter"/>
> </fo:block>
> </fo:flow>
> </fo:page-sequence>
>
> <fo:page-sequence master-reference="type-crg">
> <fo:static-content flow-name="xsl-region-before">
> <fo:block>
> <xsl:call-template name="invoice-header"/>
> </fo:block>
> </fo:static-content>
> <fo:flow flow-name="xsl-region-body">
> <fo:block>
> <xsl:apply-templates select="
> all_invoices/client/invoices/invoice"/>
> </fo:block>
> </fo:flow>
> </fo:page-sequence>
>
> ==> RESULTING PDF: I have all letters for all clients, and then all
> invoices!! No alternating page masters.
No surprise here. You'll have to select the content from the source XML
in the way you want to have it processed.
Try something like the following:
<xsl:stylesheet ...>
<xsl:template match="/">
<fo:root ...>
<fo:layout-master-set ...>
... your simple page masters here ...
</fo:layout-master-set>
<xsl:for-each select="all_invoices/client">
<fo:page-sequence master-reference="letter">
... static content for the letter ...
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:apply-templates select="letter"/>
</fo:block>
<fo:flow>
</fo:page-sequence>
<xsl:for-each select="invoices">
<fo:page-sequence master-reference="invoice">
... static content for an invoice ...
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:apply-templates select="invoice"/>
</fo:block>
<fo:flow>
</fo:page-sequence>
</xsl:for-each>
</xsl:for-each>
</fo:root>
...
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org