【问题标题】:XSL FO Docbook content left marginXSL FO Docbook 内容左边距
【发布时间】:2013-06-21 13:54:58
【问题描述】:

我正在使用 Docbook 5 (docbook-xsl-ns),使用 Apache FOP 生成 PDF,我想将所有文本移到左侧。 我该怎么做?

源 XML 是:

<section>
        <title>Usage</title>
        <programlisting>mvn archetype:generate -DarchetypeGroupId=cz.csob.javor -DarchetypeArtifactId=javor-archetypes-subcomponent -DarchetypeVersion=X.Y.Z</programlisting>
        <para>During the subcomponent project generation you will be asked for the following properties:</para>
        <itemizedlist>
            <listitem>
                <para><emphasis>parent-component-id</emphasis> - ID of the parent component, should be the name of the directory the parent component project is placed in</para>
            </listitem>
            <listitem>...

谢谢。

【问题讨论】:

  • docbook 中几乎所有事物的外观都在 docbook/fo 样式表中的文件“param.xsl”中进行控制。检查它,找到你需要改变的地方并改变它。
  • @Xdg - 你找到解决方案了吗?

标签: xml xslt apache-fop docbook


【解决方案1】:

body.start.indent 参数添加的段落缩进。

您应该使用测量值设置此参数的值,因为它在其他 XSLT 模板中用于计算。例如,下一行将完全删除段落缩进:

<xsl:param name="body.start.indent">0pt</xsl:param>

所有 XSLT 定制层应该是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
    <xsl:param name="body.start.indent">0pt</xsl:param>
</xsl:stylesheet>

Reference documentation for this topic

也可以使用其他缩进选项:

  • page.margin.inner - 左页边距
  • page.margin.outer - 右侧页边距

例如下一个参数将使这个页面布局3:

<xsl:param name="page.margin.inner">20mm</xsl:param>
<xsl:param name="page.margin.outer">10mm</xsl:param>
<xsl:param name="page.margin.top">12.5mm</xsl:param>
<xsl:param name="page.margin.bottom">15mm</xsl:param>

<xsl:param name="region.before.extent">10mm</xsl:param>
<xsl:param name="region.after.extent">5mm</xsl:param>

<xsl:param name="body.margin.top">15mm</xsl:param>
<xsl:param name="body.margin.bottom">15mm</xsl:param>

【讨论】:

  • 谢谢@Viacheslav。这对于正文的左边距确实做得很好。我们在正文的右边距使用什么?没有body.stop.indent。 (我的问题好像是,不知道叫什么东西。body.margin.leftbody.margin.right 看起来最直观,但都错了)。
  • 你可以这样使用:
猜你喜欢
  • 2013-10-13
  • 2014-03-20
  • 1970-01-01
  • 2017-04-12
  • 2013-07-18
  • 2014-01-25
  • 2016-09-29
  • 2017-06-12
  • 1970-01-01
相关资源
最近更新 更多