| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 08/06/2010 01:16:44
|
chaonngy
Joined: 25/05/2010 04:14:29
Messages: 11
Offline
|
Dear Victor,
I would like to know can I use one set of XSL and XML to generate one PDF file with different printing requirement via processing by XSLfast? That means, one PDF file consists of different records. Each record have different printing requirement. For example, first record require 4 printer bin trays for printing, second record require 2 printer bin trays for printing. If yes, I would like to know how I can do it.
Would you please reply to me regarding to the above enquiry. Thank you!
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 08/06/2010 12:44:53
|
Victor Krapivin
Joined: 04/06/2009 10:12:44
Messages: 45
Offline
|
Yes, it is possible.
First, you need to use either XSD / DTD, or XML file with all examples of your data. If you have only couople of XML files of similar structure, use XSLfast -> Extras -> Concatenate XML files tool, to build one big XML file from couple of small XML files.
Now, you need to attach your XSD / big XML file to XSLfast, and play with groupings.
For example, your XML looks like this:
Now you have two options:
1. Place every sequence (e.g. all `foo` and all `bar`) to separate pages, or
2. it should be placed in one flow order.
For first case, you need to define two main page sequences in XSLfast (and add regions for every page separately if needed). And you need to make proper page groupings for every page sequence, like this:
and
This trick is necessary to omit foo (bar) pages if no any foo (bar) nodes specified in real XML documents.
Once you defined groupings, you can operate with every specific XML piece as it is alone. For `foo` page you can freely define everything you need for printing `foo`. And for `bar` page you can define anything you need to print `bar` data.
In this approach you can place tables, static texts, and other content freely in the pages.
For second way, you need to define only one page sequence with grouping like
And all other elements should be managed by tables and inner tables content.
By adding two tables (and table groupings `foo` and `bar` respectively), you can define `foo` elements to be printed prior to `bar` elements (if exists) (or in other order), but all elements not tables either should be printed always, or should be limited to XSL-IF clauses, to define in which case it should be printed.
In this way, you'll have 5 possible cases: always shown, no foo and bar defined in XML (count(foo) + count(bar) = 0), defined foo but not bar (count(foo) > 0 and count(bar) = 0), defined bar and not foo (count(bar) > 0 and count(foo) = 0), and defined both (count(foo) > 0 and count(bar) > 0).
As you see, the second way is much more complex and have a lot of limitations, like you can't define different regions for `foo` and `bar`, as you have only one page sequence. But it have few real benefits, that might be important for you.
1. If both `foo` and `bar` defined, it will be followed without page break between them.
2. Page columns can be used for arranging `foo` and `bar` as it might be available at one PDF page.
|
Best regards,
Victor Krapivin |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 09/06/2010 01:51:11
|
chaonngy
Joined: 25/05/2010 04:14:29
Messages: 11
Offline
|
Thanks Victor.
I have another question regarding to XSLfast. I would like to know can I use one set of XML and XSL file to generate several PDF files with different records at the same time?
If yes, how can I do it?
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 09/06/2010 13:44:00
|
Victor Krapivin
Joined: 04/06/2009 10:12:44
Messages: 45
Offline
|
The XSLfast is an designer tool: it produces one XSL file, and you can use many different XML files with this XSL to produce many PDF files.
The typical use case is:
1. Generate XSL file inside XSLfast (just make layout, test it, and use File->Export command to get XSL file).
Now, once you have XSL file, yoy can print may PDF files. How?
First, you need the following tools:
- Saxon
- FOP (or XEP or AHFormatter).
Every actual XML file with data needs to be processed in two steps:
a) Via Saxon, generate XSL-FO: where my.xsl.fo - file newly produced, my.xml - current XML file with data to be printed, my.xsl is XSL file from XSLfast (see step 1).
b) Render XSL-FO file from a) to PDF: where my.pdf is newly created PDF file, and my.xsl.fo is file generated by step (a).
Note: fop.xconf should be contributed from XSLfast/lib/FOP_1.0 folder, to be sure you've using the same settings for FOP as for XSLfast. Also, we recommen to start FOP from XSLfast/bin folder, to be sure all relative paths to resources are the same as for XSLfast.
|
Best regards,
Victor Krapivin |
|
|
 |
|
|
|
|