cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Langham" <mlang...@sundn.de>
Subject AW: how to chain traitments ?
Date Tue, 16 May 2000 08:40:37 GMT
Ok - reckon I can help here (if you mean how do I do this in Cocoon):

First: Build an XML file like so (this example uses data from an SQL
database and the SQLProcessor - but you can leave that bit out. (note the
reference to the xsl stylesheet):

>>
<?xml version="1.0" ?>
<?xml-stylesheet href="projects-fo.xsl" type="text/xsl"?>
<?cocoon-process type="sql"?>
<?cocoon-process type="xslt"?>

<page>

 <connectiondefs>
  <connection name="projectdb">
   <driver>com.internetcds.jdbc.tds.Driver</driver>
   <dburl>jdbc:freetds:sqlserver:xxxxxx</dburl>
   <username>yyy</username>
   <password>yyy</password>
  </connection>
 </connectiondefs>

 <query connection="projectdb">
  select * FROM PROJMIT a, PROJEKT b Where a.MITARBEITERNUMMER={@guru} and
a.PROJEKTNUMMER = b.PROJEKTNUMMER
 </query>

 </page>
<<

Second:

Build your XSL file to look like this (again this formats the database
stuff - but you get the idea):

>>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <xsl:template match="ROWSET">
    <xsl:processing-instruction
name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master
        page-master-name="right"
        margin-top="75pt"
        margin-bottom="25pt"
        margin-left="100pt"
        margin-right="50pt">
        <fo:region-body margin-bottom="50pt"/>
        <fo:region-after extent="25pt"/>
      </fo:simple-page-master>
      <fo:simple-page-master
        page-master-name="left"
        margin-top="75pt"
        margin-bottom="25pt"
        margin-left="50pt"
        margin-right="100pt">
        <fo:region-body margin-bottom="50pt"/>
        <fo:region-after extent="25pt"/>
      </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence>

        <fo:sequence-specification>
          <fo:sequence-specifier-alternating
            page-master-first="right"
            page-master-odd="right"
            page-master-even="left"/>
        </fo:sequence-specification>

        <fo:static-content flow-name="xsl-after">
          <fo:block text-align-last="centered"
font-size="10pt"><fo:page-number/></fo:block>
        </fo:static-content>

        <fo:flow>
          <fo:block font-size="16pt"
space-after.optimum="20pt">Projekte</fo:block>
          <xsl:apply-templates/>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>

  <xsl:template match="ROW">
        <fo:block font-size="10pt" space-before.optimum="12pt"><xsl:value-of
select="PROJEKTNUMMER"/></fo:block>
        <fo:block font-size="10pt"><xsl:value-of
select="PROJEKTBEZEICHNUNG"/></fo:block>
        <fo:block font-size="10pt"><xsl:value-of
select="TATS_STARTTERMIN"/></fo:block>
  </xsl:template>


</xsl:stylesheet>
<<

And voila the result will be a PDF document.

Hope this helps

Matthew

--
=================================================================
Matthew Langham, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
Tel: +49-5251-1581-30   [mlangham@sundn.de - http://www.sundn.de]
=================================================================

-----Ursprüngliche Nachricht-----
Von: christophe maligorne [mailto:cmaligorne@odaxys.fr]
Gesendet: Dienstag, 16. Mai 2000 10:24
An: cocoon-users@xml.apache.org
Betreff: how to chain traitments ?



My purpose is :
	first : procesoring a xml file whit request parameters.
	then : transform the result in a FO file
	last : format it in PDF.
How do i this whithin a servlet ?

regards.
christophe.

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...

Mime
View raw message