DITA-OT输出PDF的样式设计

这里很乱,有空再整理

custom.xsl里面,把写标题和static-content的两段注释掉后,只剩下主要的版权内容了。

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\layout-masters.xsl 这个文件里设定了了各种主要模块,如body/header/footer还有odd/even的分派

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\attrs 这是主要特性的设置目录

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\attrs\basic-settings.xsl 页面等的基本设置

    <xsl:attribute name="start-indent"><xsl:value-of select="$side-col-width"/></xsl:attribute>

side column width 用于start-indent

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\attrs\static-content-attr.xsl 里面有__chapter__frontmatter__name__container__chapter__frontmatter__number__container ,这是章节标题的样式 加到custom.xsl可行

o/fo/xsl/fo/commons.xsl

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\attrs\commons-attr.xsl

<xsl:template name="insertChapterFirstpageStaticContent">

<fo:block xsl:use-attribute-sets="__chapter__frontmatter__number__container">
   <xsl:value-of select="$chapterNumber"/>
    </fo:block>

把block 改为inline,即可把标题放到一行上。

topic正文左侧缩进问题 本来是很正常的,但是有个 chapterlayout的问题,目前有两种样式,即minitoc和basic,前者是在左侧加一个本章的小目录,后者是普通的。

而这个minitoc是用表格来设计的,即:

        <xsl:attribute-set name="__toc__mini__table__column_1">
            <xsl:attribute name="column-number">1</xsl:attribute>
            <xsl:attribute name="column-width">35%</xsl:attribute>
        </xsl:attribute-set>

这个设置在 toc-attr.xsl里面。

DITA-OT1.8\plugins\org.dita.pdf2\cfg\fo\attrs\basic-settings.xsl里面,可以找到chapterlayout的设置:

        <xsl:param name="chapterLayout">
          <xsl:choose>
            <xsl:when test="$antArgsChapterLayout!=''"><xsl:value-of select="$antArgsChapterLayout"/></xsl:when>
            <xsl:otherwise>MINITOC</xsl:otherwise>
          </xsl:choose>
        </xsl:param>

可以在custom里面加上:

        <xsl:param name="chapterLayout">
          <xsl:choose>
            <xsl:when test="$antArgsChapterLayout!=''"><xsl:value-of select="$antArgsChapterLayout"/></xsl:when>
            <xsl:otherwise>BASIC</xsl:otherwise>
          </xsl:choose>
        </xsl:param>

把缺省情况设为 basic。

之后,正文左缩进的由 side-col-width 来设定,可以在custom里加上:

<xsl:variable name="side-col-width">30mm</xsl:variable>