Hi, my name's Stefano and I'm trying to create an online PDF catalog
using cocoon and Fop. I've realized an XML that creates this output:

<pdfDocument>
        <title>
                <copyright-item>eLogic s.r.l</copyright-item>
                <main-title>Esempio di generazione automatica di
documenti PDF</main-title>
        </title>
        <toc>
                <item>
                        <code>TABLE</code>
                        <name>Lampade da tavolo</name>
                        <indent>1</indent>
                </item>
                <item>
                        <code>BARBARA</code>
                        <name>barbara</name>
                        <indent>1</indent>
                </item>

                <item>
                        <code>FLOOR</code>
                        <name>Lampade da terra</name>
                        <indent>1</indent>
                </item>

        </toc>
        <chapter>
                <id>TABLE</id>
                <name></name>
        </chapter>
        <chapter>
                <id>BARBARA</id>
                <name></name>
        </chapter>
        <chapter>
                <id>FLOOR</id>
                <name></name>
        </chapter>
</pdfDocument>








The xsl to produce the output is:








<?xml version="1.0"?>
<!DOCTYPE index-merchant SYSTEM "dtd/libreria.dtd">
<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="Root">
 <xsl:processing-instruction
name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
    <fo:root  xmlns:fo="http://www.w3.org/1999/XSL/Format";
hyphenation-push-character-count="3"
hyphenation-remain-character-count="3">
                <fo:layout-master-set>
                        <fo:simple-page-master master-name="cover-page"
page-height="210mm" page-width="297mm">
                                <fo:region-body 
                                        margin-top="250pt"  
                                        margin-bottom="0.8in" 
                                        margin-left="1in" 
                                        margin-right="1.2in" 
                                        padding-top="16pt" 
                                        padding-bottom="16pt" 
                                        padding-left="16pt" 
                                        padding-right="16pt"
                                        /> 
                                <fo:region-after extent="1in"
margin-top="6pt" margin-bottom="0.8in" margin-left="1in"
margin-right="1.2in" /> 
                        </fo:simple-page-master>
                        <fo:simple-page-master
master-name="bare-page-left" page-height="210mm" page-width="297mm">
                                <fo:region-before extent="1in"
margin-top="6pt" margin-bottom="0.8in" margin-left="1in"
margin-right="1.2in" /> 
                                <fo:region-body 
                                        margin-top="250pt"  
                                        margin-bottom="0.8in" 
                                        margin-left="1in" 
                                        margin-right="1.2in" 
                                        padding-top="16pt" 
                                        padding-bottom="16pt" 
                                        padding-left="16pt" 
                                        padding-right="16pt" 
                                        /> 
                                <fo:region-after extent="0.9in"
padding="6pt" region-name="left-footer" /> 
                        </fo:simple-page-master>
                        <fo:simple-page-master
master-name="bare-page-right" page-height="210mm" page-width="297mm">
                                <fo:region-before extent="1in"
margin-top="6pt" margin-bottom="0.8in" margin-left="1in"
margin-right="1.2in" /> 
                                <fo:region-body 
                                        margin-top="250pt"  
                                        margin-bottom="0.8in" 
                                        margin-left="1in" 
                                        margin-right="1.2in" 
                                        padding-top="16pt" 
                                        padding-bottom="16pt" 
                                        padding-left="16pt" 
                                        padding-right="16pt" 
                                        /> 
                                <fo:region-after extent="0.9in"
padding="6pt" region-name="right-footer" /> 
                        </fo:simple-page-master>
                </fo:layout-master-set>
                <xsl:apply-templates />
        </fo:root>
</xsl:template>

<xsl:template match="photo">
        <fo:inline-graphic href="{.}" width="30px" height="40px"/>
</xsl:template>

<!--  ***************************************************************
--> 
<!--  Template di alto livello: layout per un doc PDF
--> 
<!--  ***************************************************************
--> 
<xsl:template match="pdfDocument">
        <!--  Copertina  --> 
        <xsl:apply-templates select="title"/>
        <!--  Indice --> 
        <xsl:apply-templates select="toc"/>
        <!-- Capitoli   --> 
        <xsl:apply-templates select="chapter"/>
</xsl:template>

<!--   ***************************************************************
--> 
<!--   Copertina
--> 
<!--   ***************************************************************
--> 
<xsl:template match="pdfDocument/title">
        <fo:page-sequence>
                 <fo:sequence-specification>
                        <fo:sequence-specifier-repeating
master-first="cover-page" master-repeating="cover-page"/>
                </fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">&#169; 2001 <xsl:value-of
select="copyright-item"/>.</fo:block> 
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                         <fo:table space-before.optimum="6pt"
border-width="1pt" background-color="#EEEEEE">
                        <fo:table-column column-height="180mm"
column-width="250mm"/>
                                <fo:table-body>
                                        <fo:table-row
space-before.optimum="6pt">
                                                <fo:table-cell>
                                                        <fo:block
font-size="24pt" text-align-last="centered" line-height="28pt"
font-family="sans-serif">
        
<xsl:value-of select="main-title"/>
        
</fo:block>
                                                </fo:table-cell>
                                        </fo:table-row>
                                </fo:table-body>
                        </fo:table>
                </fo:flow>
        </fo:page-sequence>
</xsl:template>

<!--   ***************************************************************
--> 
<!--   Indice
--> 
<!--   ***************************************************************
--> 
<xsl:template match="pdfDocument/toc">
        <fo:page-sequence>
                 <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
            master-odd="bare-page-right"
            master-even="bare-page-left"/>
                </fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered"><fo:page-number/></fo:block> 
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block font-size="12pt"
text-align-last="justified" line-height="28pt" font-family="sans-serif">
                                <fo:simple-link color="blue"
text-decoration="underline"
external-destination="http://devbol02.elogic.it";>Prova</fo:simple-link>
                        </fo:block>
                        <xsl:for-each select="item">
                                <fo:block font-size="12pt"
text-align-last="start" line-height="28pt" font-family="sans-serif"
text-decoration="underline">
                                        <fo:simple-link
text-decoration="underline" internal-destination="{code}">
                                                <xsl:value-of
select="name"/>
                                        </fo:simple-link>
                                </fo:block>
                        </xsl:for-each>
                </fo:flow>
        </fo:page-sequence>
</xsl:template>

<!--   ***************************************************************
--> 
<!--   Capitoli
--> 
<!--   ***************************************************************
--> 
<xsl:template match="pdfDocument/chapter">
        <fo:page-sequence>
                 <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
            master-odd="bare-page-right"
            master-even="bare-page-left"/>
                </fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered"><xsl:value-of
select="id"/></fo:block> 
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block id="{id}">
                                Ciao questa e' la categoria
<xsl:value-of select="id"/>
                        </fo:block>
                </fo:flow>
        </fo:page-sequence>
</xsl:template>
</xsl:stylesheet>






and the fo code created by fop is this:







<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd";>

<fo:root hyphenation-push-character-count="3"
hyphenation-remain-character-count="3"
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
        <fo:layout-master-set>
                <fo:simple-page-master master-name="cover-page"
page-height="210mm" page-width="297mm">
                        <fo:region-body margin-bottom="0.8in"
margin-left="1in" margin-right="1.2in" margin-top="250pt"
padding-bottom="16pt" padding-                          left="16pt"
padding-right="16pt" padding-top="16pt"></fo:region-body>
                        <fo:region-after extent="1in"
margin-bottom="0.8in" margin-left="1in" margin-right="1.2in"
margin-top="6pt"></fo:region-after>
                </fo:simple-page-master>
                <fo:simple-page-master master-name="bare-page-left"
page-height="210mm" page-width="297mm">
                        <fo:region-before extent="1in"
margin-bottom="0.8in" margin-left="1in" margin-right="1.2in"
margin-top="6pt"></fo:region-before>
                        <fo:region-body margin-bottom="0.8in"
margin-left="1in" margin-right="1.2in" margin-top="250pt"
padding-bottom="16pt" padding-                          left="16pt"
padding-right="16pt" padding-top="16pt"></fo:region-body>
                        <fo:region-after extent="0.9in" padding="6pt"
region-name="left-footer"></fo:region-after>
                </fo:simple-page-master>
                <fo:simple-page-master master-name="bare-page-right"
page-height="210mm" page-width="297mm">
                        <fo:region-before extent="1in"
margin-bottom="0.8in" margin-left="1in" margin-right="1.2in"
margin-top="6pt"></fo:region-before>
                        <fo:region-body margin-bottom="0.8in"
margin-left="1in" margin-right="1.2in" margin-top="250pt"
padding-bottom="16pt" padding-                          left="16pt"
padding-right="16pt" padding-top="16pt"></fo:region-body>
                        <fo:region-after extent="0.9in" padding="6pt"
region-name="right-footer"></fo:region-after>
                </fo:simple-page-master>
        </fo:layout-master-set>
        
        
        <fo:page-sequence>
                <fo:sequence-specification>
                        <fo:sequence-specifier-repeating
master-first="cover-page"
master-repeating="cover-page"></fo:sequence-specifier-repeating>
                </fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">&copy; 2001 eLogic
s.r.l.</fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:table background-color="#EEEEEE"
border-width="1pt" space-before.optimum="6pt">
                        <fo:table-column column-height="180mm"
column-width="250mm"></fo:table-column>
                                <fo:table-body>
                                        <fo:table-row
space-before.optimum="6pt">
                                                <fo:table-cell>
                                                        <fo:block
font-family="sans-serif" font-size="24pt" line-height="28pt"
text-align-last="centered">Esempio di generazione automatica di
documenti PDF</fo:block>
                                                </fo:table-cell>
                                        </fo:table-row>
                                </fo:table-body>
                        </fo:table>
                </fo:flow>
        </fo:page-sequence>
        <fo:page-sequence>
                <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
master-even="bare-page-left"
master-odd="bare-page-right"></fo:sequence-specifier-alternating>
</fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">
                                <fo:page-number></fo:page-number>
                        </fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block font-family="sans-serif"
font-size="12pt" line-height="28pt" text-align-last="justified">
                                <fo:simple-link color="blue"
external-destination="http://devbol02.elogic.it";
text-decoration="underline">Prova</fo:simple-link>
</fo:block>
                        <fo:block font-family="sans-serif"
font-size="12pt" line-height="28pt" text-align-last="start"
text-decoration="underline">
                                <fo:simple-link
internal-destination="TABLE" text-decoration="underline">Lampade da
tavolo</fo:simple-link></fo:block>
                        <fo:block font-family="sans-serif"
font-size="12pt" line-height="28pt" text-align-last="start"
text-decoration="underline">
                                <fo:simple-link
internal-destination="BARBARA"
text-decoration="underline">barbara</fo:simple-link></fo:block>
                        <fo:block font-family="sans-serif"
font-size="12pt" line-height="28pt" text-align-last="start"
text-decoration="underline">
                                <fo:simple-link
internal-destination="FLOOR" text-decoration="underline">Lampade da
terra</fo:simple-link></fo:block>
                </fo:flow>
        </fo:page-sequence>
        <fo:page-sequence>
                <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
master-even="bare-page-left"
master-odd="bare-page-right"></fo:sequence-specifier-alternating>
</fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">TABLE</fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block id="TABLE">Ciao questa e' la categoria
TABLE</fo:block>
                </fo:flow>
        </fo:page-sequence>
        <fo:page-sequence>
                <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
master-even="bare-page-left"
master-odd="bare-page-right"></fo:sequence-specifier-alternating>
</fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">BARBARA</fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block id="BARBARA">Ciao questa e' la
categoria BARBARA</fo:block>
                </fo:flow>
        </fo:page-sequence>
        <fo:page-sequence>
                <fo:sequence-specification>
                        <fo:sequence-specifier-alternating
master-even="bare-page-left"
master-odd="bare-page-right"></fo:sequence-specifier-alternating>
</fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                        <fo:block font-family="sans-serif"
font-size="9pt" text-align-last="centered">FLOOR</fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                        <fo:block id="FLOOR">Ciao questa e' la categoria
FLOOR</fo:block>
                </fo:flow>
        </fo:page-sequence>
</fo:root>
<!-- This page was served in 548 milliseconds by Cocoon 1.8 -->





Everything seems to work fine, but, when I click on an internal link,
nothing happens (the external link works fine). Could you give me help?
Thank you so much.
Best greetings.

Stefano Angelici

P.S. I edited the pdf document created by cocoon and i found "Producer
(FOP 0.12.2 [dev])" even if the .jar in cocoon libs is fop_0_13_0.jar.

--
Stefano Angelici - Sviluppo Software
eLogic S.r.l. - Sistemi Internet per le Aziende - www.elogic.it
Via Paolo Nanni Costa, 30 - 40133 Bologna
Tel: 0513145611 Fax: 0513145699

Reply via email to