Search code examples
xmlxsltdita

A modification in layout-masters.xsl in original plugin not shown in output PDF file


I made modification in layout-masters.xsl and added the layout-masters.xsl in catalog.xml. However, the change does not appear in the output PDF file. How can I get it to recognize the modification?

If I directly modify layout-masteres in org.dita.pdf2 the modification appears to the output PDF file. Therefore, it seems like layout-masters-attr.xsl is working correctly, but somehow fo is not referring to layout-masteres.xsl in my plugin.

The layout-masteres.xsl file:

<!-- 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>

The layout-masteres-attrs.xsl file:

<!--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>

The catalog.xml file:

<?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>

Solution

  • The customization's catalog.xml can redirect only a limited number of XSLTs (and all the possible redirects are commented out in the catalog.xml). So you cannot just add a new mapping for a certain XSLT document and assume it will work. In your case you should add the overwritten xsl:templates directly to the "fo/xsl/custom.xsl" custom stylesheet.