You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by th...@snecma.fr on 2002/08/20 15:26:08 UTC

Réf. : Re: Question about FOP/XSL

Thanks a lot for the reply. It now works fine.
Merci beaucoup


"Pierre-Yves Chauveau" <pi...@manpower.fr> on 14/08/2002
18:14:59

Veuillez répondre à fop-user@xml.apache.org

Pour :    fop-user@xml.apache.org
Pour :    fop-user
cc :   (ccc : Thierry PETIT/SN06/SNECMA)
cc :
ccc : Thierry PETIT/SN06/SNECMA
ccc : Thierry PETIT

Objet :   Re: Question about FOP/XSL

I hope it can help but I think it's just a matter of XSL and not FOP.
You match first the ligne element, and inside try to match the nomsColonnes
element.
However, the nomsColonnes element is not inside the ligne element.
Therefore
the template for nomColonnes is never matched.
Anyway, you'd better use the fo:table-header.

Ex:
<xsl:template match="paquet">
        <fo:block space-after="5mm"/>
        <fo:table>
                 <fo:table-column column-width="16mm"/> <!-- Niveau -->
                 <fo:table-column column-width="16mm"/> <!-- Repere fonct.
-->
                 <fo:table-column column-width="48mm"/> <!-- Ref. Fabricant
-->
                <fo:table-header>
                        <xsl:apply-templates select="nomsColonnes"/>
                </fo:table-header>
                <fo:table-body>
                          <xsl:apply-templates select="ligne"/>
                 </fo:table-body>
        </fo:table>
</xsl:template>
----- Original Message -----
From: <th...@snecma.fr>
To: <fo...@xml.apache.org>
Sent: Wednesday, August 14, 2002 5:45 PM
Subject: Question about FOP/XSL


Hello everyone,
My  name is Thierry PETIT. I work at Snecma Company (aircrafts engine) near
Paris (France).
My  application  creates  reports.  I  wish  to generate the following data
spreadsheet:
|------+---------+-------------|
|Niveau|Repère   |Ref.         |
|      |fonct.   |Fabricant    |
|------+---------+-------------|
|  1   |J11      |J7R_REP1_ITM1|
|------+---------+-------------|
|  1   |J11      |J7R_REP1_ITM2|
|------+---------+-------------|



So,  my  application  generates this kind of XML file (a "paquet" is like a
data spreadsheet) and I use FOP to convert XML files into PDF files.

<?xml version="1.0" encoding="ISO-8859-1"?>
<rapport>
<titre1>Statut de définition et d'industrialisation des articles par
DATE</titre1>
<titre2>Definition and industrialisation status of items using DATE
effectivity</titre2>
<dateCur>14/08/2002</dateCur>
<sequence>
<paquet>
<nomsColonnes>
<nom><![CDATA[Niveau]]></nom>
<nom><![CDATA[Repère fonct.]]></nom>
<nom><![CDATA[Ref. Fabricant]]></nom>
</nomsColonnes>
<ligne>
<element>&#160;&#160;1</element>
<element><![CDATA[J11]]></element>
<element><![CDATA[J7R_REP1_ITM1]]></element>
</ligne>
<ligne>
<element>&#160;&#160;1</element>
<element><![CDATA[J11]]></element>
<element><![CDATA[J7R_REP1_ITM2]]></element>
</ligne>
</paquet>
<option>Article : <![CDATA[J7R0J7A0020 (JSC56 MOTEUR ASSEMBLE)]]></option>
<option>Date d'effectivité : <![CDATA[01/09/2002]]></option>
</sequence>
<pageGarde>Date : <![CDATA[14/08/2002]]></pageGarde>
<pageGarde></pageGarde>
<pageGarde>Article : <![CDATA[J7R0J7A0020 (JSC56 MOTEUR
ASSEMBLE)]]></pageGarde>
<pageGarde></pageGarde>
<findoc> </findoc>
<findoc>***** Fin impression *****</findoc>
</rapport>

You will find above the definition of the "paquet" in my XSL file.

<!-- ***************************************** -->
<!-- Template "paquet". -->
<xsl:template match="paquet">
        <fo:block space-after="5mm"/>
        <fo:table>
                 <fo:table-column column-width="16mm"/> <!-- Niveau -->
                 <fo:table-column column-width="16mm"/> <!-- Repere fonct.
-->
                 <fo:table-column column-width="48mm"/> <!-- Ref. Fabricant
-->
                 <fo:table-body>
                          <xsl:apply-templates select="ligne"/>
                 </fo:table-body>
        </fo:table>
</xsl:template>

<!-- ****************************** -->
<!-- Template "ligne". -->
<xsl:template match="ligne[position() mod 40=1 and position()=1]">
        <xsl:apply-templates select="nomsColonnes"/>
        <fo:table-row>
                <xsl:apply-templates select="element"/>
        </fo:table-row>
</xsl:template>

<xsl:template match="ligne[position() mod 40=1 and position()!=1]">
        <fo:table-row break-before="page">
        </fo:table-row>
        <xsl:apply-templates select="nomsColonnes"/>
        <fo:table-row>
                <xsl:apply-templates select="element"/>
        </fo:table-row>
</xsl:template>

<xsl:template match="ligne[position() mod 40!=1]">
        <fo:table-row>
                <xsl:apply-templates select="element"/>
        </fo:table-row>
</xsl:template>

<!-- ********************** -->
<!Template "nomsColonnes. -->
<xsl:template match="nomsColonnes">
        <fo:table-row background-color="rgb(200,200,200)">
                <xsl:apply-templates select="nom"/>
        </fo:table-row>
</xsl:template>

<xsl:template match="nom">
        <fo:table-cell border="0.5pt solid black">
        <fo:block font-size="7pt"
                font-family="sans-serif"
                font-weight="bold"
                vertical-align="middle"
                text-align="center">
                <xsl:apply-templates/>
        </fo:block></fo:table-cell>
</xsl:template>

My  problem is the following: I never see the first line of the spreadsheet
(the name of the columns, "nomColonnes" in my file). Could you help me ?
Please let me know if there are any further details you require.
Thanking you in advance, I'm sending you my best regards.





...



...