At 2009-07-20 08:40 -0700, Ming Yu wrote:
I'm new to xslfo but I have been using xslt for a while. My question
is, what is the best practice to output xml to pdf?
Wouldn't "best" be relative to your requirements? What are your
requirements? You don't say.
As far as I understand, those are the step involved:
1. xml -> xslfo through xslt
2. xslfo -> pdf through FOP
Yes, that is very typical. Your information is expressed in XML and
the layout of that information is expressed in XSL-FO.
But when writing xsl for step 1, I have to put all the fo coding
inside xsl for the formatting. It seems to be very distracting.
But you say you've been using XSLT for a while. If you have been
using XSLT to create HTML then you have to put all of the HTML coding
inside XSLT for the rendering. How is that different?
XSLT is a templating language used to assemble an output structure
from examples of that structure found in your stylesheet. If you
need an output structure of XSL-FO then you need to use examples in
XSL-FO. If you need an output structure of HTML then you need to use
examples in HTML. What XSLT work have you been doing that is different?
If I know what data I want from the xml file and what design I want
for the pdf output, is it possible to build the fo file first and
add the xsl piece later on?
This is atypical but not impossible. I needed this for my UBL
stylesheet work. I have published two environments where you create
the XSL-FO first and then annotate it with information about your XML
... you then press a button and out comes a synthesized
stylesheet. These two environments are available for free download:
http://www.CraneSoftwrights.com/resources/#literatexslt
http://www.CraneSoftwrights.com/resources/#resultxslt
But it is not at all typical and the only reason it was "best" for my
UBL stylesheet work is that I needed an environment to create dozens
of XSLT stylesheets based on the United Nations Layout Key. I
described the layout using XSL-FO as a standalone instance, annotated
it with UBL information, and the output from my processes is an XSLT
stylesheet:
http://www.CraneSoftwrights.com/resources/ublss/
It is certainly not "best" for 99.44% of my stylesheet work.
I hope this helps.
. . . . . . . . . Ken
--
XSLT/XSL-FO/XQuery hands-on training - Oakland, CA, USA 2009-08-03
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
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>
--~--