AW: [Wyonacms-users] Fo in 5 steps

"Scherler, Thorsten" <[email protected]> Mon, 28 Oct 2002 15:37:50 +0100
Newsgroups gmane.comp.cms.wyona.devel,gmane.comp.cms.wyona.user
Message-ID <[email protected]>
Hello group,

I've just modified the doc2xml.xsl.

Now there is a nice header and footer. The one before wasn't that nice I have to admit!

In my department I will create the report (formally in MS access) with wyona.

Basiclly the idea is to have a query on a db, transform the data with xsl and create a pdf.

If you keen to know how it works drop me a mail and I will post the steps to the mailinglist!


-----Ursprüngliche Nachricht-----
Von: Scherler, Thorsten 
Gesendet: Montag, 28. Oktober 2002 13:49
An: [email protected]
Betreff: [Wyonacms-users] Fo in 5 steps


Hello group,

I have noticed that where some discussion about FO.

Here is an easy way to implemend fo within Wyona.

1) in the sitemap (live or authoring)
find: 	<map:components>
add:	<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" logger="sitemap.serializer.fo2pdf" mime-type="application/pdf"/>
		</map:serializers>

2) within the same sitemap:
find: 	<!-- =========================== Pipelines ================================ -->
	<map:pipelines>
		<map:pipeline>
add: 			<map:match pattern="*.pdf">
				<map:generate src="docs/publication/{1}.xml"/>
				<map:transform src="stylesheets/publication/wd/pdf/doc2pdf.xsl"/>
				<map:serialize type="fo2pdf"/>
			</map:match>
3) the doc2pdf.xsl should look like this (more information @ http://www.ibiblio.org/xml/books/bible/updates/15.html):
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by eric cartman (sp int) -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<!-- generate PDF page structure -->
	<xsl:template match="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<fo:simple-page-master master-name="page" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
					<fo:region-before extent="2cm"/>
					<fo:region-body margin-top="3cm"/>
					<fo:region-after extent="1.5cm"/>
				</fo:simple-page-master>
				<fo:page-sequence-master master-name="all">
					<fo:repeatable-page-master-alternatives>
						<fo:conditional-page-master-reference master-reference="page" page-position="first"/>
					</fo:repeatable-page-master-alternatives>
				</fo:page-sequence-master>
			</fo:layout-master-set>
			<fo:page-sequence master-reference="all">
				<fo:flow flow-name="xsl-region-body">
					<fo:block>
						<fo:list-item-label>
							<fo:block text-align="start" font-weight="bold">Weidmüller Telefonmarketing</fo:block>
						</fo:list-item-label>
						<fo:block>
							<fo:leader leader-pattern="rule" rule-thickness="2pt"/>
						</fo:block>
						<xsl:apply-templates/>
					</fo:block>
					<fo:block text-align="start" font-weight="bold">
  ©  <fo:basic-link external-destination="url(http://www.WEIDMUELLER.com/)" color="#0000C0" text-decoration="underline">
  Weidmueller
  <fo:wrapper font-weight="bold" color="#000000"/>
						</fo:basic-link>
  2002/2003 
  </fo:block>
					<fo:block text-align="end">Seite:  <fo:page-number/>
					</fo:block>
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
	<!-- process paragraphs -->
	<xsl:template match="p">
		<fo:block>
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>
	<!-- convert sections to XSL-FO headings -->
	<xsl:template match="s1">
		<fo:block font-size="24pt" color="red" font-weight="bold">
			<xsl:apply-templates select="@title"/>
		</fo:block>
		<xsl:apply-templates/>
	</xsl:template>
</xsl:stylesheet>

4.) example doc.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<page>
	<title>This is the pageOne.xml example</title>
	<s1 title="Section one">
		<p>This is the text of section one</p>
		<p>This is the text od Weidmueller</p>
	</s1>
</page>

5.) go to http://localhost:8088/wyona-cms/weidmueller/doc.pdf
where weidmueller is the dir where the *.xml is.


> Mit freundlichem Gruss,
> 
> Thorsten Scherler
> Marketing / Telefonmarketing
> 
> Weidmüller GmbH & Co.
> P.O. Box 2807
> 33058 Paderborn
> Tel.:+ 49 - 5252-960-350
> Fax:+ 49 - 5252-960-116
> eMail: [email protected]
> http://www.weidmueller.de
> 
> 

_______________________________________________
WyonaCMS-users mailing list
[email protected]
http://mail.wyona.org/cgi-bin/mailman/listinfo/wyonacms-users