Reputation: 347
I am trying to include the content of the below dita topic file on my cover page, but so far I have not been able.
The file that I need to include on the cover page is located on the local system and is referenced by the bookmap.
I am using DITA-OT 1.4.2 along with RenderX Xep.
I need to use this because I have a few books to render to PDF and the cover page change based on the book.
Here is my cover page content:
<?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>
I am using the front-matter_1.0.xsl file to generate my cover page with the following template.
<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>
Upvotes: 1
Views: 1252
Reputation: 11
Placing a topic as cover page is not provided.
WIth recent DITA versions (DITA 1.2/DITA-OT1.8.5)++ There are a few strategies pointing in another direction:
Use DITA 1.2 key definitions combined with DITAVAL filtering to place "publication specific" content dynamically to the cover page. e.g.
Place product-specific keys in your bookmap elements like <title><ph keyref="productName"/><title>
Place the cover art as a image keyref in the title tag like <title><image keyref="product/imageID"/><title>
Make a specialization of the org.dita.pdf2
plugin (DITA-OT 1.8.5 or higher) for each publication type and place individual background images in 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>
Upvotes: 1