输出 PDF 文件中未显示原始插件中布局的修改-masters.xsl
A modification in layout-masters.xsl in original plugin not shown in output PDF file
我在layout-masters.xsl
中进行了修改,并在catalog.xml
中添加了layout-masters.xsl
。但是,更改不会出现在输出 PDF 文件中。我怎样才能让它识别修改?
如果我直接在 org.dita.pdf2
中修改 layout-masteres
,修改会出现在输出的 PDF 文件中。因此,似乎 layout-masters-attr.xsl
工作正常,但不知何故 fo 在我的插件中没有引用 layout-masteres.xsl
。
layout-masteres.xsl
文件:
<!-- First page-->
<fo:simple-page-master master-name="front-matter-first" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body.first"/>
<fo:region-before region-name="first-body-header" xsl:use-attribute-sets="region-before.first"/>
<fo:region-after region-name="first-body-footer" xsl:use-attribute-sets="region-after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="front-matter-last" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body.first"/>
<fo:region-before region-name="last-frontmatter-header" xsl:use-attribute-sets="region-before.first"/>
<fo:region-after region-name="last-frontmatter-footer" xsl:use-attribute-sets="region-after"/>
</fo:simple-page-master>
layout-masteres-attrs.xsl
文件:
<!--first page without header (pale blue) -->
<xsl:attribute-set name="region-body.first">
<xsl:attribute name="margin-top">
<xsl:value-of select="$page-margin-top-first"/>
</xsl:attribute>
<xsl:attribute name="margin-bottom">
<xsl:value-of select="$page-margin-bottom"/>
</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="background-color">#84f9ff</xsl:attribute>
</xsl:attribute-set>
catalog.xml
文件:
<?xml version='1.0' encoding='utf-8'?>
<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl" />
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl" />
<uri name="cfg:fo/font-mappings.xsl" uri="fo/font-mappings.xsl" />
<uri name="cfg:fo/layout-masters.xsl" uri="fo/layout-masters.xsl" />
</catalog>
定制的 catalog.xml 只能重定向有限数量的 XSLT(并且所有可能的重定向都在 catalog.xml 中被注释掉了)。因此,您不能只为某个 XSLT 文档添加一个新映射并假设它会起作用。
在您的情况下,您应该将覆盖的 xsl:templates 直接添加到 "fo/xsl/custom.xsl" 自定义样式表中。
我在layout-masters.xsl
中进行了修改,并在catalog.xml
中添加了layout-masters.xsl
。但是,更改不会出现在输出 PDF 文件中。我怎样才能让它识别修改?
如果我直接在 org.dita.pdf2
中修改 layout-masteres
,修改会出现在输出的 PDF 文件中。因此,似乎 layout-masters-attr.xsl
工作正常,但不知何故 fo 在我的插件中没有引用 layout-masteres.xsl
。
layout-masteres.xsl
文件:
<!-- First page-->
<fo:simple-page-master master-name="front-matter-first" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body.first"/>
<fo:region-before region-name="first-body-header" xsl:use-attribute-sets="region-before.first"/>
<fo:region-after region-name="first-body-footer" xsl:use-attribute-sets="region-after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="front-matter-last" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body.first"/>
<fo:region-before region-name="last-frontmatter-header" xsl:use-attribute-sets="region-before.first"/>
<fo:region-after region-name="last-frontmatter-footer" xsl:use-attribute-sets="region-after"/>
</fo:simple-page-master>
layout-masteres-attrs.xsl
文件:
<!--first page without header (pale blue) -->
<xsl:attribute-set name="region-body.first">
<xsl:attribute name="margin-top">
<xsl:value-of select="$page-margin-top-first"/>
</xsl:attribute>
<xsl:attribute name="margin-bottom">
<xsl:value-of select="$page-margin-bottom"/>
</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="background-color">#84f9ff</xsl:attribute>
</xsl:attribute-set>
catalog.xml
文件:
<?xml version='1.0' encoding='utf-8'?>
<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl" />
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl" />
<uri name="cfg:fo/font-mappings.xsl" uri="fo/font-mappings.xsl" />
<uri name="cfg:fo/layout-masters.xsl" uri="fo/layout-masters.xsl" />
</catalog>
定制的 catalog.xml 只能重定向有限数量的 XSLT(并且所有可能的重定向都在 catalog.xml 中被注释掉了)。因此,您不能只为某个 XSLT 文档添加一个新映射并假设它会起作用。 在您的情况下,您应该将覆盖的 xsl:templates 直接添加到 "fo/xsl/custom.xsl" 自定义样式表中。