【问题标题】:Dita to pdf partial two-column outputDita to pdf 部分两列输出
【发布时间】:2017-06-27 09:29:12
【问题描述】:

我想在 dita/xml 地图上创建一个 pdf 基础,其中一个主题以报纸样式的两列输出格式设置。

我找到了要在我的 layout-masters-attr 样式表中使用的属性:<xsl:attribute name="column-count">2</xsl:attribute>

这将为整个文档创建一个两列输出。所以我在区域主体属性集中添加了一个@outputclass 参数。这并没有给我正确的结果。有人知道如何为 ditamap 中的单个主题创建两列输出吗?

我的样式表定义:

<xsl:attribute-set name="region-body" use-attribute-sets="region-body.odd"/>            
<xsl:attribute-set name="region-body.odd">
<xsl:attribute name="margin-top">
<xsl:value-of select="$body-margin"/>
</xsl:attribute>
<xsl:attribute name="margin-bottom">
<xsl:value-of select="$body-margin"/>
</xsl:attribute>
<xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-left' else 'margin-right'}">
<xsl:value-of select="$page-margin-inside"/>
</xsl:attribute>
<xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-right' else 'margin-left'}">
<xsl:value-of select="$page-margin-outside"/>
</xsl:attribute>
<xsl:attribute name="column-count">
<xsl:choose>
<xsl:when test="@outputclass = 'twocol'">2</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>

我的主题定义:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_hbq_pxv_yy">
<title>test</title>
<prolog/>
<body outputclass="twocol">

【问题讨论】:

    标签: xml pdf xslt dita


    【解决方案1】:

    问题在于页面序列必须具有正确的列数属性以及 PDF2 插件的工作方式,这是为文档、目录、索引、正文等的特定区域设置的。您可以不只是你

    要达到您想要的效果,您只需获取主题的内容并将其放入 2 列表中即可。虽然不是最佳解决方案,但它是当前实施所能获得的最佳解决方案。

    【讨论】:

    • 嗨,谢谢,我也想过这个,不是首选的解决方案。
    【解决方案2】:

    如果您有机会使用 Antenna House Formatter 生成 PDF,您可以通过指定 fo:block-container/column-count="2" 轻松生成两列布局。

    列数/CSS (-ah-)列数

    http://www.antenna.co.jp/AHF/help/v64e/ahf-ext.html#columns

    样式表就这么简单:

    <xsl:template match="*[contains(@class,' topic/body ')][string(@outputclass) eq 'twocol']" priority="2">
        <fo:block-container column-count="2">
            <xsl:next-match/>
        </fo:block-container>
    </xsl:template>
    

    【讨论】:

    • 您好,谢谢,我们正在使用天线罩,这将是解决方案,谢谢
    猜你喜欢
    • 2017-02-19
    • 1970-01-01
    • 2014-05-26
    • 2018-11-19
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 2019-03-08
    • 2018-09-18
    相关资源
    最近更新 更多