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

Subject: Re: [xsl] Working example xml+xsl to .fo file
From: eleonora46@xxxxxxx
Date: Tue, 18 Nov 2008 23:10:07 +0100
Dear Vasu,

Thanks for the example. Fortunately I had Martin Honnens working example, so I could debug yours.
Your one has several problems:
1.  in xsl file this is no good (first line)
> <?XML version="1.0"?> 
2. You use "of" instead of "fo". This causes fop not to produce pdf.
3. also did not like at the beginning of the xml file:
 <?XML version="1.0"?> 
After having fixed these,  I could create pdf using your files.

I use saxon9_1_0_2 for xslt conversion and fop 0.94 to convert to pdf.

Thanks, eleonora

-------- Original-Nachricht --------
> Datum: Tue, 18 Nov 2008 19:55:48 +0000 (GMT Standard Time)
> Von: "vasu chakkera" <vasucv@xxxxxxxxx>
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: [xsl] Working example xml+xsl to .fo file

> 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@xxxxxxx 
> Date: 18/11/2008 18:18:18 
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> 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@xxxxxxxxxxxxx> 
> > An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> > Betreff: Re: [xsl] Working example XML+xsl to .of file 
>  
> > eleonora46@xxxxxxx 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 gehvrt? Der kann`s mit allen:
> http://www.gmx.net/de/go/multimessenger 

-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
f|r nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

Current Thread