Hi,

it seems that stylesheets doesn't have code for styling preface titles.
Please find bellow modified templates that do the trick:

  <xsl:template match="*[contains(@class,' topic/title ')]">
    <xsl:choose>
      <xsl:when test="parent::*[contains(@class,' topic/topic ')]">
        <xsl:variable name="titleClass">
          <xsl:call-template name="topicTitleClass"/>
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="$titleClass = 'part-title'">
            <fo:block xsl:use-attribute-sets="part-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'chapter-title'">
            <fo:block xsl:use-attribute-sets="chapter-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'appendices-title'">
            <fo:block xsl:use-attribute-sets="appendices-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'appendix-title'">
            <fo:block xsl:use-attribute-sets="appendix-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section1-title'">
            <fo:block xsl:use-attribute-sets="section1-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section2-title'">
            <fo:block xsl:use-attribute-sets="section2-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section3-title'">
            <fo:block xsl:use-attribute-sets="section3-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section4-title'">
            <fo:block xsl:use-attribute-sets="section4-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section5-title'">
            <fo:block xsl:use-attribute-sets="section5-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section6-title'">
            <fo:block xsl:use-attribute-sets="section6-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section7-title'">
            <fo:block xsl:use-attribute-sets="section7-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section8-title'">
            <fo:block xsl:use-attribute-sets="section8-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'section9-title'">
            <fo:block xsl:use-attribute-sets="section9-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:when test="$titleClass = 'preface-title'">
            <fo:block xsl:use-attribute-sets="preface-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:when>
          <xsl:otherwise>
            <fo:block xsl:use-attribute-sets="topic-title">
              <xsl:call-template name="topicTitle"/>
            </fo:block>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>

      <xsl:when test="parent::*[contains(@class,' topic/section ')]">
        <fo:block xsl:use-attribute-sets="section-title">
          <xsl:call-template name="commonAttributes"/>

          <!-- Sections are not numbered. -->

          <xsl:apply-templates/>
        </fo:block>
      </xsl:when>

      <xsl:when test="parent::*[contains(@class,' reference/refsyn ')]">
        <fo:block xsl:use-attribute-sets="refsyn-title">
          <xsl:call-template name="commonAttributes"/>

          <!-- Refsyns are not numbered. -->

          <xsl:apply-templates/>
        </fo:block>
      </xsl:when>

      <xsl:when test="parent::*[contains(@class,' topic/example ')]">
        <fo:block xsl:use-attribute-sets="example-title">
          <xsl:call-template name="commonAttributes"/>

          <xsl:call-template name="titlePrefix"/>

          <xsl:apply-templates/>
        </fo:block>
      </xsl:when>

      <xsl:when test="parent::*[contains(@class,' topic/fig ')]">
        <fo:block xsl:use-attribute-sets="fig-title">
          <xsl:call-template name="captionAttributes"/>
          <xsl:call-template name="commonAttributes"/>

          <xsl:call-template name="titlePrefix"/>

          <xsl:apply-templates/>
        </fo:block>
      </xsl:when>

      <xsl:when test="parent::*[contains(@class,' topic/table ')]">
        <fo:block xsl:use-attribute-sets="table-title">
          <xsl:call-template name="captionAttributes"/>
          <xsl:call-template name="commonAttributes"/>

          <xsl:call-template name="titlePrefix"/>

          <xsl:apply-templates/>
        </fo:block>
      </xsl:when>

      <xsl:otherwise>
        <fo:block xsl:use-attribute-sets="title">
          <xsl:call-template name="commonAttributes"/>

          <!-- No need to call titlePrefix. -->

          <xsl:apply-templates/>
        </fo:block>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="topicTitleClass">
    <xsl:variable name="topicId" select="../@id"/>
    <xsl:variable name="tocEntry" select="(u:tocEntry($topicId),
$ditacLists/ditac:chunkList/ditac:chunk/ditac:topic[@id = $topicId])[1]"/>

        <!-- I have added lookup to ditac:chunk, because preface doesn't have
tocEntry. It will be better to use xsl:key for making lookup fasters --
here and inside u:tocEntry function -->

    <xsl:choose>
      <xsl:when test="exists($tocEntry)">
        <xsl:variable name="role" select="string($tocEntry/@role)"/>
        <xsl:choose>
          <xsl:when test="$role = 'part' or
            $role = 'chapter' or
            $role = 'appendices' or
            $role = 'appendix' or
            $role = 'section1' or
            $role = 'section2' or
            $role = 'section3' or
            $role = 'section4' or
            $role = 'section5' or
            $role = 'section6' or
            $role = 'section7' or
            $role = 'section8' or
            $role = 'section9' or
            $role = 'preface'">
            <xsl:value-of select="concat($role, '-title')"/>
          </xsl:when>
          <xsl:otherwise>topic-title</xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>topic-title</xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:attribute-set name="preface-title"/>

HTH,

Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: [email protected]      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature

 
--
XMLmind DITA Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/ditac-support

Reply via email to