No localization exists
Jiri_Navratil na orcz.cz
Jiri_Navratil na orcz.cz
Středa Duben 8 10:13:49 CEST 2009
Používám saxon,
příkaz je tento
saxon -o $1.fo $1.xml ../docbook/xsl/htmlhelp/tisk-fop.xsl
Verzi už mám starší - 1.68.1 nicméně na windows mi to funguje dobře se
stejnou verzí
Přikládám použité xsl:
tisk-fop.xsl
<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="../fo/docbook.xsl"/>
<!-- Načtení oprav pro FOP -->
<xsl:import href="fop-common-muj.xsl"/>
<!-- Velikost papíru -->
<xsl:param name="paper.type" select="'A4'"/>
<!-- XSLT procesor můľe pouľívat roząíření pro callouts apod. -->
<xsl:param name="use.extensions" select="1"/>
<xsl:param name="fop.extensions" select="1"/>
<!-- Velikost písma textu -->
<xsl:param name="body.font.master">10</xsl:param>
<xsl:param name="body.font.family" select="'CourierNew'"/>
<xsl:param name="body.margin.bottom" select="'0.5in'"></xsl:param>
<!-- Velikost okrajů -->
<xsl:param name="page.margin.inner" select="'0.5in'"/>
<xsl:param name="page.margin.outer" select="'0.5in'"/>
<xsl:param name="page.margin.bottom" select="'0.5in'"></xsl:param>
<xsl:param name="page.margin.top" select="'0.5in'"></xsl:param>
<!-- Číslování sekcí a kapitol -->
<xsl:param name="section.autolabel" select="0"/>
<xsl:param name="section.label.includes.component.label" select="0"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="appendix.autolabel" select="0"/>
<xsl:param name="part.autolabel" select="1"/>
<xsl:param name="preface.autolabel" select="0"/>
<!-- Nadpisy jsou zarovnány s textem, jak je zvykem v evropské typografii
-->
<xsl:param name="title.margin.left" select="'0pt'"/>
<xsl:param name="alignment">left</xsl:param>
<xsl:param name="draft.watermark.image" select="''"/>
<xsl:param name="tablecolumns.extension" select="'1'"></xsl:param>
</xsl:stylesheet>
a fop-common-muj.xsl
<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<!-- Variable list redefinition -->
<xsl:template match="variablelist" mode="vl.as.list">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="term-width">
<xsl:call-template name="dbfo-attribute">
<xsl:with-param name="pis"
select="processing-instruction('dbfo')"/>
<xsl:with-param name="attribute" select="'term-width'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="termlength">
<xsl:choose>
<xsl:when test="$term-width != ''">
<xsl:value-of select="$term-width"/>
</xsl:when>
<xsl:when test="@termlength">
<xsl:variable name="termlength.is.number">
<xsl:value-of select="@termlength + 0"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$termlength.is.number = 'NaN'">
<!-- if the term length isn't just a number, assume it's a measurement -->
<xsl:value-of select="@termlength"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@termlength"/>
<xsl:text>em</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- FIXME: this should be a parameter! -->
<xsl:call-template name="longest.term">
<xsl:with-param name="terms" select="varlistentry/term"/>
<xsl:with-param name="maxlength" select="12"/>
</xsl:call-template>
<xsl:text>em</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--
<xsl:message>
<xsl:text>term width: </xsl:text>
<xsl:value-of select="$termlength"/>
</xsl:message>
-->
<xsl:if test="title">
<xsl:apply-templates select="title" mode="list.title.mode"/>
</xsl:if>
<fo:list-block id="{$id}"
provisional-distance-between-starts="{$termlength}"
provisional-label-separation="0.1in"
xsl:use-attribute-sets="list.block.spacing">
<xsl:apply-templates mode="vl.as.list"/>
</fo:list-block>
</xsl:template>
<!-- Oprava cisel stranek kapitol v obsahu -->
<xsl:template match="chapter">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="master-reference">
<xsl:call-template name="select.pagemaster"/>
</xsl:variable>
<fo:page-sequence id="{$id}"
hyphenate="{$hyphenate}"
master-reference="{$master-reference}">
<xsl:attribute name="language">
<xsl:call-template name="l10n.language"/>
</xsl:attribute>
<xsl:if test="not(preceding::chapter) and not(parent::part)">
<xsl:attribute name="initial-page-number">1</xsl:attribute>
</xsl:if>
<xsl:if test="$double.sided != 0">
<xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="." mode="running.head.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="running.foot.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<fo:flow flow-name="xsl-region-body">
<fo:block id="{$id}">
<xsl:call-template name="chapter.titlepage"/>
</fo:block>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc"/>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<!-- Correct header (only remove FOP warning) -->
<xsl:template name="header.table">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<!-- default is a single table style for all headers -->
<!-- Customize it for different page classes or sequence location -->
<xsl:variable name="candidate">
<fo:table table-layout="fixed" width="100%">
<xsl:call-template name="head.sep.rule"/>
<fo:table-column column-number="1"
column-width="proportional-column-width(1)"/>
<fo:table-column column-number="2"
column-width="proportional-column-width(1)"/>
<fo:table-column column-number="3"
column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row height="14pt">
<fo:table-cell text-align="left"
display-align="before">
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'left'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="center"
display-align="before">
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'center'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right"
display-align="before">
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'right'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:variable>
<!-- Really output a header? -->
<xsl:choose>
<xsl:when test="$pageclass = 'titlepage' and $gentext-key = 'book'
and $sequence='first'">
<!-- no, book titlepages have no headers at all -->
</xsl:when>
<xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
<!-- no output -->
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Correct footer -->
<xsl:template name="footer.table">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<xsl:variable name="candidate">
<fo:table table-layout="fixed" width="100%">
<xsl:call-template name="foot.sep.rule"/>
<fo:table-column column-number="1"
column-width="proportional-column-width(1)"/>
<fo:table-column column-number="2"
column-width="proportional-column-width(1)"/>
<fo:table-column column-number="3"
column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row height="14pt">
<fo:table-cell text-align="left"
display-align="after">
<fo:block>
<xsl:call-template name="footer.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'left'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="center"
display-align="after">
<fo:block>
<xsl:call-template name="footer.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'center'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right"
display-align="after">
<fo:block>
<xsl:call-template name="footer.content">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="position" select="'right'"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:variable>
<xsl:choose>
<xsl:when test="$pageclass='titlepage' and $gentext-key='book'
and $sequence='first'">
</xsl:when>
<xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Glossary customization -->
<xsl:param name="glossterm.width" select="'2.1cm'"/>
<xsl:template match="glossentry" mode="glossary.as.list">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<fo:list-item xsl:use-attribute-sets="normal.para.spacing">
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0
or $glossary.collection != ''">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<fo:list-item-label end-indent="label-end()">
<fo:block font-weight="bold">
<xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
<xsl:apply-templates select="indexterm"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.list"/>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!-- Dedication hack -->
<xsl:template match="dedication" mode="dedication">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="master-reference">
<xsl:call-template name="select.pagemaster"/>
</xsl:variable>
<fo:page-sequence id="{$id}"
hyphenate="{$hyphenate}"
master-reference="{$master-reference}">
<xsl:attribute name="language">
<xsl:call-template name="l10n.language"/>
</xsl:attribute>
<xsl:attribute name="format">
<xsl:call-template name="page.number.format"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="not(preceding::chapter
or preceding::preface
or preceding::appendix
or preceding::article
or preceding::dedication
or parent::part
or parent::reference)">
<!-- if there is a preceding component or we're in a part, the -->
<!-- page numbering will already be adjusted
<xsl:attribute name="initial-page-number">1</xsl:attribute>-->
</xsl:when>
<xsl:when test="$double.sided != 0">
<xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="." mode="running.head.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="running.foot.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="dedication.titlepage"/>
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template name="dedication.titlepage.recto">
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="dedication.titlepage.recto.style"
margin-left="{$title.margin.left}" font-size="24.8832pt"
font-family="{$title.font.family}" font-weight="bold">
<!-- <xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor-or-self::dedication[1]"/>
</xsl:call-template> --></fo:block>
<xsl:choose>
<xsl:when test="dedicationinfo/subtitle">
<xsl:apply-templates mode="dedication.titlepage.recto.auto.mode"
select="dedicationinfo/subtitle"/>
</xsl:when>
<xsl:when test="docinfo/subtitle">
<xsl:apply-templates mode="dedication.titlepage.recto.auto.mode"
select="docinfo/subtitle"/>
</xsl:when>
<xsl:when test="subtitle">
<xsl:apply-templates mode="dedication.titlepage.recto.auto.mode"
select="subtitle"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
S pozdravem Jiří Navrátil
Jirka Kosek <jirka na kosek.cz>
Odeslal: docbook-bounces na linux.cz
01.04.2009 13:46
Odpovězte prosím uživateli
Diskuse o dokumentačním systemu DocBook <docbook na linux.cz>
Komu
Diskuse o dokumentačním systemu DocBook <docbook na linux.cz>
Kopie
Předmět
Re: No localization exists
Jiri_Navratil na orcz.cz wrote:
> Dobry den !
> Delam prevod z xml do PDF pomocí Fopu na Windows a je to OK.
> Potřeboval jsem to zacit delat na unixu, ale vypisuje mi to tyto hlasky:
Asi by bylo dobré napsat, jaký přesně příkaz spouštíte, jaký používáte
XSLT procesor, jakou máte verzi stylů, jestli používáte nějaké vlastní
úpravy stylů, ...
--
------------------------------------------------------------------
Jirka Kosek e-mail: jirka na kosek.cz http://www.kosek.cz
------------------------------------------------------------------
Profesionální školení a poradenství v oblasti technologií XML.
Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
http://docbook.cz Stránky o dokumentačním formátu DocBook
http://xmlguru.cz Blog mostly about XML for English readers
------------------------------------------------------------------
_______________________________________________
Docbook mailing list
Docbook na linux.cz
http://www.linux.cz/mailman/listinfo/docbook
Další informace o konferenci Docbook