DITA PDF再现封面页面定制

时间:2014-05-23 15:48:40

标签: xml xslt

我试图在我的封面上包含以下dita主题文件的内容,但到目前为止我还没有。

我需要在封面上包含的文件位于本地系统上,并由bookmap引用。

我正在使用DITA-OT 1.4.2和RenderX Xep。

我需要使用这个,因为我有几本书要翻译成PDF,封面页也会根据书改变。

这是我的封面内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
       outputclass="frontmatter"  id="topic010"
       ditaarch:DITAArchVersion="1.0"
       domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d)                          (topic ut-d)"
       class="- topic/topic ">
   <title class="- topic/title ">Front Matters</title>
   <body class="- topic/body ">
      <image width="500"
             id="image_forewordheader"
             placement="inline"
             alt="heading"
             href="heading.png"
             class="- topic/image "/>
      <p outputclass="subject" class="- topic/p "> Subject test heading </p>
      <image height="10"
             width="500"
             id="img010"
             alt="image010"
             href="image010.png"
             placement="inline"
             class="- topic/image "/>
      <p class="- topic/p ">Some content goes here. This is a test front matter content.
      </p>
      <p class="- topic/p ">  </p>
      <p class="- topic/p ">  </p>

      <p class="- topic/p ">
         <image href="image011.png"
            alt="image011"
            id="image011"
            placement="inline"
            class="- topic/image "/>
      </p>
   </body>
</topic>

我正在使用front-matter_1.0.xsl文件生成包含以下模板的封面页。

<xsl:template name="createFrontMatter_1.0">
        <fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count">
            <xsl:call-template name="insertFrontMatterStaticContents"/>
            <fo:flow flow-name="xsl-region-body">
                <fo:block xsl:use-attribute-sets="__frontmatter">
                    <!-- set the title -->
                    <fo:block xsl:use-attribute-sets="__frontmatter__title">
                        <xsl:choose>
                            <xsl:when test="$map/*[contains(@class,' topic/title ')][1]">
                                <xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/>
                            </xsl:when>
                            <xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]">
                                <xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/>
                            </xsl:when>
                            <xsl:when test="//*[contains(@class, ' map/map ')]/@title">
                                <xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </fo:block>

                    <!-- set the subtitle -->
                    <xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/>

                    <fo:block xsl:use-attribute-sets="__frontmatter__owner">
                        <xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/>
                    </fo:block>
                    <xsl:text>Preface </xsl:text>
                </fo:block>

       <!--         <xsl:call-template name="createPreface"/>-->

       <!—Use topic content front matter topic   as cover page     -->


                <fo:block xsl:use-attribute-sets="__frontmatter__owner">
                <fo:block>
                    <xsl:apply-templates select="//*[contains(@outputclass,'frontmatter')]"/>
                </fo:block>
                </fo:block>
            </fo:flow>

1 个答案:

答案 0 :(得分:0)

未提供主题作为封面。

最近的DITA版本(DITA 1.2 / DITA-OT1.8.5)++有一些策略指向另一个方向:

  1. 将DITA 1.2键定义与DITAVAL过滤结合使用,以放置&#34;出版物特定的&#34;动态内容到封面。 e.g。

    • 将产品特定的密钥放在bookmap元素中,例如<title><ph keyref="productName"/><title>

    • 将封面图片作为图片keyref放置在标题标记中,如<title><image keyref="product/imageID"/><title>

  2. 针对每种发布类型对org.dita.pdf2插件(DITA-OT 1.8.5或更高版本)进行专门化,并将单个背景图像放在front-matter.xsl中。

    <fo:block-container absolute-position="absolute"
              top="-2cm" left="-2cm" width="21cm" height="29.7cm" background-repeat="no-repeat"
              background-image="Customization/OpenTopic/common/artwork/ManualCoverPageA4_V2-01.png">
              <fo:block/>
            </fo:block-container>
    
相关问题