Docbook Digest, Vol 18, Issue 3

Jiri Tyr jiri.tyr na cern.ch
Pátek Srpen 15 17:42:16 CEST 2008


Tak asi to nebere prilohy, tak jeste jednou:

--- SOUBOR propustka-fo.xsl ----------------------------
<?xml version="1.0" encoding="utf-8"?>


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


<!-- output settings -->
<xsl:output
   method="xml"
   encoding="UTF-8"
   indent="yes"
/>


<!-- main template -->
<xsl:template match="/">
   <fo:root>
     <fo:layout-master-set>
       <fo:simple-page-master master-name="A4" 
xsl:use-attribute-sets="simple.page.master">
         <fo:region-body margin-bottom="10mm"/>
       </fo:simple-page-master>
     </fo:layout-master-set>

     <fo:page-sequence master-reference="A4" 
xsl:use-attribute-sets="page.sequence">
       <fo:flow flow-name="xsl-region-body">
         <fo:block xsl:use-attribute-sets="title">Propustky</fo:block>
         <xsl:apply-templates/>
       </fo:flow>
     </fo:page-sequence>
   </fo:root>
</xsl:template>


<!-- propustka element -->
<xsl:template match="propustka">
   <fo:block xsl:use-attribute-sets="block.border">
     <fo:table xsl:use-attribute-sets="table">
       <fo:table-column column-width="3.5cm"/>
       <fo:table-column column-width="proportional-column-width(1)"/>
       <fo:table-body>
         <fo:table-row>
           <fo:table-cell xsl:use-attribute-sets="cell.label">
             <fo:block>Propustka pro:</fo:block>
           </fo:table-cell>
           <fo:table-cell>
             <fo:block><xsl:value-of select="jmeno"/></fo:block>
           </fo:table-cell>
         </fo:table-row>
         <fo:table-row>
           <fo:table-cell xsl:use-attribute-sets="cell.label">
             <fo:block>Datum:</fo:block>
           </fo:table-cell>
           <fo:table-cell>
             <fo:block><xsl:value-of select="datum"/></fo:block>
           </fo:table-cell>
         </fo:table-row>
         <fo:table-row>
           <fo:table-cell xsl:use-attribute-sets="cell.label.signature">
             <fo:block>Podpis:</fo:block>
           </fo:table-cell>
           <fo:table-cell>
             <fo:block-container 
xsl:use-attribute-sets="signature"><fo:block></fo:block></fo:block-container>
           </fo:table-cell>
         </fo:table-row>
       </fo:table-body>
     </fo:table>
   </fo:block>
</xsl:template>


<!-- ================
      STYLE DEFINITION
      ================ -->

<!-- simple page master -->
<xsl:attribute-set name="simple.page.master">
   <xsl:attribute name="page-width">210mm</xsl:attribute>
   <xsl:attribute name="page-height">297mm</xsl:attribute>
   <xsl:attribute name="margin-top">20mm</xsl:attribute>
   <xsl:attribute name="margin-bottom">10mm</xsl:attribute>
   <xsl:attribute name="margin-left">20mm</xsl:attribute>
   <xsl:attribute name="margin-right">20mm</xsl:attribute>
</xsl:attribute-set>

<!-- page sequence - global font setting -->
<xsl:attribute-set name="page.sequence">
   <xsl:attribute name="font-family">Arial</xsl:attribute>
   <xsl:attribute name="font-size">12pt</xsl:attribute>
</xsl:attribute-set>

<!-- title -->
<xsl:attribute-set name="title">
   <xsl:attribute name="text-align">center</xsl:attribute>
   <xsl:attribute name="font-size">20pt</xsl:attribute>
   <xsl:attribute name="font-weight">bold</xsl:attribute>
   <xsl:attribute name="space-after">5mm</xsl:attribute>
</xsl:attribute-set>

<!-- block border -->
<xsl:attribute-set name="block.border">
   <xsl:attribute name="border">1px solid silver</xsl:attribute>
   <xsl:attribute name="background-color">#ffffcc</xsl:attribute>
   <xsl:attribute name="padding">5mm 5mm 5mm 5mm</xsl:attribute>
   <xsl:attribute name="space-after">10mm</xsl:attribute>
</xsl:attribute-set>

<!-- table -->
<xsl:attribute-set name="table">
   <xsl:attribute name="table-layout">fixed</xsl:attribute>
   <xsl:attribute name="width">100%</xsl:attribute>
</xsl:attribute-set>

<!-- cell label -->
<xsl:attribute-set name="cell.label">
   <xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>

<!-- cell label -->
<xsl:attribute-set name="cell.label.signature">
   <xsl:attribute name="font-weight">bold</xsl:attribute>
   <xsl:attribute name="display-align">center</xsl:attribute>
</xsl:attribute-set>

<!-- signature line -->
<xsl:attribute-set name="signature">
   <xsl:attribute name="width">5cm</xsl:attribute>
   <xsl:attribute name="height">1cm</xsl:attribute>
   <xsl:attribute name="border-bottom">1px dotted black</xsl:attribute>
</xsl:attribute-set>

</xsl:transform>
--------------------------------------------------------

--- SOUBOR propustka.xml -------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<propustky>
   <propustka>
     <jmeno>Pavel Novak</jmeno>
     <datum>8.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Karel Novak</jmeno>
     <datum>9.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Josef Novak</jmeno>
     <datum>10.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Ludvik Novak</jmeno>
     <datum>11.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Jiri Novak</jmeno>
     <datum>12.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Petr Novak</jmeno>
     <datum>13.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Milos Novak</jmeno>
     <datum>14.8.2008</datum>
   </propustka>
   <propustka>
     <jmeno>Zdenek Novak</jmeno>
     <datum>15.8.2008</datum>
   </propustka>
</propustky>
--------------------------------------------------------

Prevod do PDF pomoci prikazu (asi bude potreba upravit pro vas system):

saxon -o ./propustka.fo ./propustka.xml ./propustka-fo.xsl
fop -c /etc/xml/fop/conf/myfop.xconf -fo ./propustka.fo -pdf ./propustka.pdf

S pozdravem,
Jiri Tyr


Jiri Tyr wrote:
> Zkuste pouzit priklad v priloze.
> 
> S pozdravem,
> Jiri Tyr
> 
> 
> Petr Hracek wrote:
>> Tak jsem to puvodne myslel.
>>
>> V XML pouze nadefinovat Jmeno a Datum.
>> Zbytek by uz udelala transformace XSL do PDF
>>
>>> Dobry den,
>>>
>>> a nebylo by lepsi pouzit nejaky obecny XML soubor a z nej pomoci XSLT 
>>> vytvorit PDF? V DocBooku se to take bez upravy XSL sablony neobejde.
>>>
>>> S pozdravem,
>>> Jiri Tyr
>>>
>>>
>>> Petr Hracek wrote:
>>>> Ahoj vsichni,
>>>>
>>>> chtel bych si udelat vygenerovani propustky pomoci DocBooku.
>>>> Jak se da vygenerovat obdelnik, ve kterem bude napsan text:
>>>>
>>>> Melo by to vypadak zhruba takhle:
>>>> |--------------------------------------------------------|
>>>> |    Propustka pro :  <JMENO>                       |
>>>> |    Datum:                                                         |
>>>> |    Podpis:                                                        |
>>>> |--------------------------------------------------------|
>>>>
>>>> Diky moc
>>>> Petr
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Docbook mailing list
> Docbook na linux.cz
> http://www.linux.cz/mailman/listinfo/docbook



Další informace o konferenci Docbook