Cislovani kapitol na samostatnem radku...

Jiri Tyr jiri.tyr na cern.ch
Pátek Duben 27 15:22:58 CEST 2007


Dobry den,

snazim se zmenit format onacovani kapitol z tohoto:

Kapitola 1 Nazev kapitoly

na toto:

Kapitola 1
Nazev kapitoly

Nasel jsem, ze v teto nkonferenci se na to uz nekdo ptal 
(http://www.linux.cz/lists/archive/docbook/1157.html) a tak jsem se 
snazil postupovat podle daneho odkazu 
(http://sagehill.net/docbookxsl/TitleFontSizes.html#ChapterTitles) v 
odpovedi. Nicmene jsem neuspel a neni mi jasne jak presne postupovat. 
Udelal jsem toto:

1) Vytvoril jsem soubor docbook_fo_book.xsl a do nej vlozil kod:

<xsl:template name="chapappendix.title">
  <xsl:param name="node" select="."/>
  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="object" select="$node"/>
    </xsl:call-template>
  </xsl:variable>

  <fo:block id="{$id}"
            xsl:use-attribute-sets="chap.label.properties">
    <xsl:call-template name="gentext">
      <xsl:with-param name="key">
        <xsl:choose>
          <xsl:when test="$node/self::chapter">chapter</xsl:when>
          <xsl:when test="$node/self::appendix">appendix</xsl:when>
        </xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="$node" mode="label.markup"/>
  </fo:block>
  <fo:block xsl:use-attribute-sets="chap.title.properties">
    <xsl:apply-templates select="$node" mode="title.markup"/>
  </fo:block>
</xsl:template>

Sice v souboru fo/component.xsl je template component.title trosku 
slozitejsi, ale to snad nevadi.

2) Vytvoril jsem soubor chapappendix.xml a ze souboru 
fo/titlepage.templates.xml jsem zpopiroval:

<t:titlepage t:element="chapter" t:wrapper="fo:block" ...>...</t:titlepage>

a take:

<t:titlepage t:element="appendix" t:wrapper="fo:block" ...>...</t:titlepage>

a pozmenil jsem:

<title t:named-template="component.title" 
param:node="ancestor-or-self::chapter[1]"/>

na toto:

<title t:named-template="chapappendix.title" 
param:node="ancestor-or-self::chapter[1]"/>

3) Vygeneroval jsem ze souboru chapappendix.xml pomoci 
template/template.xsl soubor chapappendix.xsl.
4) Soubor chapappendix.xsl jsem naimportoval do souboru docbook_fo_book.xsl.
5) Zkusil jsem prelozit testovaci kapitolu Saxonem a hlasi mi to, ze 
nemuze najit chap.label.properties. To je logicke, protoze to neni zatim 
nikde definovano. Nevim totiz, kde a jak to nadefinovat (v prikladu na 
strance to neni).


Muzete mi prosim poradit, jak a kde nadefinovat attribute-sets 
chap.label.properties a chap.title.properties? Popripade jestli jsem 
nekde neco udelal spatne.

S pozdravem,
Jiri Tyr



Další informace o konferenci Docbook