xsl-list
[Top] [All Lists]

Re: [xsl] Working example xml+xsl to .fo file

2008-11-18 14:56:22
Eleonora, 
You have to understand how the FO works. And things will look much brighter
to you. 
Before going into XSL:FO , you need to know about XSLT. 
 
If you understand well that XSLT can transform XML into any output format
file you desire, then we are one step closer. 
 
The First Step in a PDF production is to Produce a .FO file from XML. 
 
An XSL file is written to produce this .FO file. 
 
This .FO file is sent into what is called a PDF renderer to produce the PDF
files. Google for renderx, FOP , antennahouse etc, and you can read quite a
lot on these. 
 
Let us now do what you asked for : a Hello World example: 
 
Consider you have an XML : 
 
<?XML version="1.0"?> 
<hello> 
Hello World 
</hello> 
 
You write a XSL as below to produce a .FO file. 
==================================================================== 
<?XML version="1.0"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3
org/1999/XSL/Transform"> 
<xsl:template match="/"> 
<of:root xmlns:of="http://www.w3.org/1999/XSL/Format"; > 
<of:layout-master-set> 
<of:simple-page-master master-name="LetterPage" page-width="8.5in" 
Page-height="11in" > 
<of:region-body region-name="PageBody" margin="0.7in"/> 
</of:simple-page-master> 
</of:layout-master-set> 
<of:page-sequence master-reference="LetterPage"> 
<of:flow flow-name="PageBody"> 
<of:block> 
<xsl:value-of select = "hello"/> 
</of:block> 
</of:flow> 
</of:page-sequence> 
</of:root> 
</xsl:template> 
</xsl:stylesheet> 
========================================================================= 
 
Running the Transform  results in 
 
=============================================================================
==== 
<?XML version="1.0" encoding="UTF-16"?> 
<of:root xmlns:of="http://www.w3.org/1999/XSL/Format";> 
<of:layout-master-set> 
<of:simple-page-master master-name="LetterPage" page-width="8.5in"
page-height="11in"> 
<of:region-body region-name="PageBody" margin="0.7in" /> 
</of:simple-page-master> 
</of:layout-master-set> 
<of:page-sequence master-reference="LetterPage"> 
<of:flow flow-name="PageBody"> 
<of:block> 
Hello World 
</of:block> 
</of:flow> 
</of:page-sequence> 
</of:root> 
=============================================================================
= 
 
 
Now if you use any FO renderer , you will get a PDF with Hello World. 
 
To get a quick check , you can download the antennahouse xsl formatter. It
allows you to select a .FO file and converts it into PDF file. 
http://www.antennahouse.com/ 
 
This is a pretty good tool to play around with the FO. 
 
As it looks simple, please do not think that FO is simple, I strongly advice
you to read atleast to the level of fair understanding on how to write the
stylesheets to produce an FO file and what is the structure of a FO tree and
the formatting specifics. 
 
Google for XSL:Fo and you will soon find loads of articles .. 
 
HTH 
Vasu 
-------Original Message------- 
 
From: eleonora46(_at_)gmx(_dot_)net 
Date: 18/11/2008 18:18:18 
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
Subject: Re: [xsl] Working example XML+xsl to .of file 
 
Dave, 
 
Typo. 
XML+xsl 
 
I read http://www.cafeconleche.org/books/bible2/chapters/ch18.html 
It says all the time: 
File *.xsl and *.XML has been run through an XSLT processor to produce an
XSL-FO document, 
And I should like to see a working example for this run. I am unable to find
out, 
How it gets those .of files. 
 
Thanks, eleonora 
-------- Original-Nachricht -------- 
Datum: Tue, 18 Nov 2008 18:13:06 +0000 
Von: Dave Pawson <davep(_at_)dpawson(_dot_)co(_dot_)uk> 
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
Betreff: Re: [xsl] Working example XML+xsl to .of file 
 
eleonora46(_at_)gmx(_dot_)net wrote: 

Yes. I need a working example that creates from 
XML+csl a .of file, and not a HTML file. 

what's a 'csl' file? 


regards 

-- 
Dave Pawson 
 
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
http://www.gmx.net/de/go/multimessenger 
 
--~------------------------------------------------------------------ 
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> 
--~-- 
 

--~------------------------------------------------------------------
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>