Appendice 17
Foglio di stile XSLT per la creazione di una versione e-book PDF di Baltico adoperando Apache FOP (passando da un output XSL-FO)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>
<xsl:strip-space elements="p"/>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="cover" page-height="23cm" page-width="15.1cm">
<fo:region-body/>
</fo:simple-page-master>
<fo:simple-page-master master-name="principale" page-height="23cm"
page-width="15.1cm" margin-top="1cm" margin-bottom="1cm" margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-before extent="1.5cm"/>
<fo:region-after extent="1.5cm"/>
<fo:region-body margin-top="1.8cm" margin-bottom="1.8cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!---->
<xsl:for-each select="//div0">
<!---->
<fox:outline internal-destination="{@type}-{@n}">
<fox:label>
<xsl:value-of select="p"/>
</fox:label>
<xsl:for-each select="*/head[@type='tem']">
<fox:outline internal-destination="{../@id}">
<fox:label>
<xsl:value-of select="../@n"/> - <xsl:value-of select="translate(.,' ',' ')"/>
<!---->
</fox:label>
</fox:outline>
</xsl:for-each>
</fox:outline>
</xsl:for-each>
<xsl:for-each select="//div">
<xsl:for-each select="head">
<fox:outline internal-destination="{../@id}">
<fox:label>
<xsl:value-of select="."/>
</fox:label>
</fox:outline>
</xsl:for-each>
</xsl:for-each>
<!---->
<xsl:apply-templates/>
</fo:root>
</xsl:template>
<xsl:template match="teiHeader"/>
<xsl:template match="text">
<xsl:apply-templates/>
</xsl:template>
<!---->
<xsl:template match="front">
<!---->
<fo:page-sequence master-reference="cover">
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center" vertical-align="middle">
<fo:external-graphic src="c:\temp\PDF\copertinag.jpg" width="15.1cm" height="23cm"/>
<!---->
</fo:block>
</fo:flow>
</fo:page-sequence>
<xsl:apply-templates/>
<!---->
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body">
<fo:block space-before="1cm" font-size="15pt" text-align="end" font-family="Times
Roman" font-style="italic">
A Bartolomeo Collura, mio padre.
</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body">
<fo:block space-before="1cm" font-size="13pt" text-align="justify" font-family="Times
Roman" line-height="1.5em" margin-right="0.5cm" margin-left="0.5cm">
Contagiati dal delirio delle escavazioni, subito accompagnato dalla comparsa di affaristi
scrocconi, si scoprirono impensate doti di imprenditori; e sventrando valli e colline
sognarono di arricchire, mentre copioso colava lo zolfo e si ampliavano i cimiteri. Due
secoli di picconate cambiarono la faccia della terra. Subito si appalesò il disastro,
ma in quel turbinio di fortune immaginate nessuno vi fece caso. Corsero ai ripari quando
già il vento screpolava gli spalti delle zolfare e le erbacce cominciavano a
nasconderne le bocche. Fu come se un'ostinata bonaccia si fosse posata su un mare che era
stato in tempesta. Non lontano dai ruderi, oziosi, aspettarono sussidi e pensioni; e
polvere e silenzio sedimentarono sulla loro assurda epopea.
</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body">
<fo:block space-before="1cm" space-after="0.4cm" font-size="13pt" text-align="left"
font-family="Times Roman" line-height="1.2em" margin-left="3.4cm">
Zufolava mentre andava al lavoro
e parlava spesso di un futuro di
benessere e di abbondanza
</fo:block>
<fo:block font-size="13pt" text-align="end" font-family="Times Roman"
font-variant="small-caps">
Sherwood Anderson,
</fo:block>
<fo:block font-size="13pt" text-align="end" font-family="Times Roman"
font-style="italic">
Un povero bianco.         
</fo:block>
</fo:flow>
</fo:page-sequence>
<!---->
</xsl:template>
<!---->
<xsl:template match="div[@type='ded']" priority="1"/>
<xsl:template match="div[@type='ep']" priority="1"/>
<xsl:template match="titlePage">
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template match="docAuthor">
<fo:block space-after="3.8cm" font-size="23pt" text-align="center" font-weight="bold"
font-family="Times Roman">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="docTitle">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="titlePart[@type='main']">
<fo:block space-after="10pt" font-size="30pt" text-align="center" font-weight="bold"
font-family="Times Roman">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="titlePart[@type='sub']">
<fo:block space-after="8.7cm" font-size="18pt" text-align="center" font-weight="bold"
font-family="Times Roman">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="docImprint">
<fo:block font-size="18pt" text-align="center" font-weight="bold" font-family="Times
Roman">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!---->
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="div0">
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body">
<fo:block space-after="15pt" font-size="20pt" text-align="center" font-weight="bold"
font-family="Times Roman" id="{@type}-{@n}">
<xsl:value-of select="p"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="div0/p"/>
<xsl:template match="div1">
<fo:page-sequence master-reference="principale">
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" font-size="12pt" font-family="sans-serif"
font-weight="normal" font-style="italic"> MATTEO COLLURA - BALTICO: edizione
elettronica</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" margin-top="0.5cm">
<fo:block space-before="0.7cm" text-align="center" font-size="12pt"
font-family="sans-serif" font-weight="normal">
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" text-align="justify" font-size="14pt"
font-family="Verdana, Geneva, Arial, Helvetica, sans-serif" font-weight="normal"
line-height="1.7em">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template match="head[@type='ord']">
<fo:block space-after="17pt" font-size="20pt" text-align="left" font-weight="bold"
font-family="Times Roman" id="{../@id}">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="head[@type='conv']">
<fo:block space-after="17pt" font-size="20pt" text-align="left" font-weight="bold"
font-family="Times Roman" id="{../@id}">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="head[@type='tem']">
<fo:block space-after="20pt" font-size="17pt" text-align="left" font-weight="bold"
font-family="Times Roman">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="p">
<fo:block text-indent="24pt">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="back">
<fo:page-sequence master-reference="principale">
<fo:flow flow-name="xsl-region-body" text-align="justify" font-size="14pt"
font-family="Verdana, Geneva, Arial, Helvetica, sans-serif" font-weight="normal"
line-height="1.7em">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template match="div/signed">
<fo:block text-align="end" font-size="14pt" font-family="Verdana, Geneva, Arial,
Helvetica, sans-serif" font-weight="normal">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="l">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="*[@rend='bloc']">
<fo:block margin-left="3.5cm" margin-right="2.5cm">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="*[@rend='italic']">
<fo:inline font-style="italic">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="q[@type='epistola']">
<fo:block text-indent="24pt"><xsl:apply-templates/></fo:block>
</xsl:template>
</xsl:stylesheet>