Nastaveni pevneho konce stranky
Jirka Kosek
jirka na kosek.cz
Čtvrtek Březen 3 20:06:48 CET 2005
Jan Tosovsky wrote:
> Diky za trpelivost. Presna a jasna formulace je jak vidim me slabe misto,
> snad nyni:
> Jde mi o to vlozit pred zacatek kapitoly jeden list papiru (pouze pro .fo).
> Bud na nem bude obrazek z jedne strany ci z obou, bud pres cely papir ci jen
> z casti.
Tak už jsem to snad pochopil :-)
> Diky uvedenemu odkazu nyni jiz tak trochu vim, jak vlozit na
> pozadovane misto stranku rozvrzenou podle svych potreb. Rad bych jeste nejak
> zajistil, aby prave sem odkazoval obsah ci bookmarky, jinak totiz bude tento
> list papiru vlastne soucasti predchozi casti knihy. Pak by to bylo cele k
> nicemu.
>
> Nejjednodussi by bylo vlozit uvodni obrazek (v mem pripade pujde o foto) az
> do vlastni kapitoly. Snazim se vsak o digitalizaci jedne publikace a rad
> bych co nejvice zachoval jeji puvodni cleneni...
Požadované obrázky je nejlepší vložit do metainformací kapitoly. Něco ve
stylu:
<chapter>
<title>Ze života chroustů</title>
<chapterinfo>
<mediaobject>
<imageobject>
<imagedata fileref="chrobak.svg"/>
</imageobject>
</mediaobject>
</chapterinfo>
...
</chapter>
Pak je potřeba upravit styly tak, aby generovaly výstup, který
potřebujete. Chceme-li například generovat něco před kapitolou, vezmeme
šablonu pro kapitolu ze souboru component.xsl a upravíme ji:
<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>
<!-- Začátek úprav -->
<fo:page-sequence master-reference="jmeno-nejakeho-pagemasteru"
force-page-count="even">
<fo:flow flow-name="xsl-region-body">
<fo:block id="{$id}">
<fo:external-graphic
src="url({chapterinfo/mediaobject/imageobject/imagedata/@fileref})"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<!-- Konec úprav -->
<fo:page-sequence 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:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="initial-page-number">
<xsl:call-template name="initial.page.number">
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="force-page-count">
<xsl:call-template name="force.page.count">
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-character">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'hyphenation-character'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-push-character-count">
<xsl:call-template name="gentext">
<xsl:with-param name="key"
select="'hyphenation-push-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-remain-character-count">
<xsl:call-template name="gentext">
<xsl:with-param name="key"
select="'hyphenation-remain-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<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="set.flow.properties">
<xsl:with-param name="element" select="local-name(.)"/>
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
<!-- Tady jsem zrušil ID, je nastavené o stránku dříve -->
<fo:block>
<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>
Samozřejmě v praxi v upraveném kódu asi budete vkládat více
formátovacích objektů a vyhrajete si s jejich parametry. Ale princip je
zhruba takový, možná je v šabloně někde chyba, psal jsem to z hlavy a
netestoval.
--
------------------------------------------------------------------
Jirka Kosek e-mail: jirka na kosek.cz http://www.kosek.cz
------------------------------------------------------------------
Profesionální školení a poradenství v oblasti technologií XML.
Podívejte se na náš nově spuštěný web http://DocBook.cz
Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
------------- další část ---------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3158 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.linux.cz/pipermail/docbook/attachments/20050303/b0005c59/attachment.bin>
Další informace o konferenci Docbook