xslt and xslfo

2009-07-20 Thread Ming Yu

Hi,

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? As far as I understand, those are 
the step involved:

1. xml -> xslfo through xslt
2. xslfo -> pdf through FOP

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.

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? I saw that xmlspy provides a tool to generate xsl:fo file from a design. Is 
this a good tool to use?

Any help is highly appreciated!

Ming


  

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: xslt and xslfo

2009-07-20 Thread bonekrusher

Hi Ming,

No, you can not build the fo file first and add the xsl piece later on. XSLT
does not work this way. The fo namespace is required to output fo
instructions to meet the xsl-fo specification which is read by FOP.

Altova's stylevision is good when you are just learning, but eventually you
will need to learn how to code xsl-fo.


Regards,

Phil

Ming Yu wrote:
> .
> 
> Hi,
> 
> 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? As far as I understand,
> those are the step involved:
> 
> 1. xml -> xslfo through xslt
> 2. xslfo -> pdf through FOP
> 
> 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.
> 
> 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? I saw that xmlspy provides a tool to generate xsl:fo file
> from a design. Is this a good tool to use?
> 
> Any help is highly appreciated!
> 
> Ming
> 
> 
>   
> 
> -
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/xslt-and-xslfo-tp24572152p24572979.html
Sent from the FOP - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: xslt and xslfo

2009-07-20 Thread Sergiu Dumitriu

Ming Yu wrote:

Hi,

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? As far as I understand, those are 
the step involved:

1. xml -> xslfo through xslt
2. xslfo -> pdf through FOP

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.

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? I saw that xmlspy provides a tool to generate xsl:fo file from a design. Is 
this a good tool to use?


The first step is *usually* done through xslt, but that's not mandatory. 
You have to obtain an xslfo file from the original XML in any possible 
way. Now, the problem with xslt is that it mixes the processing code 
with the output in a not-too-clear way, which is a bit confusing if you 
don't have a good understanding of both languages.


You could take another approach, such as using an imperative programming 
language (like Java or C++ or Python) with an XML library, or a 
templating language (like Velocity, JSP or PHP), which allows you to 
actually write the skeleton of the resulting xslfo, with tiny blocks of 
processing code where the data from the XML must be inserted. The latter 
approach is closer to your idea of writing the xslfo first. You could 
write an example static xslfo file, then replace pieces of text with XML 
processing instructions.


Whatever approach you take, the process will still be valid, so feel 
free to choose the one you are more familiar with.


--
Sergiu Dumitriu
http://purl.org/net/sergiu/

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org