Coloring the title on a cover page
Posted: Wed Jan 25, 2017 6:24 pm
Hi all,
We are using a customized framework in oXygen, which means that instead of a front page, we have a cover page in our PDF outputs. This cover page integrates a graphic and a title in the color that the user specifies (only "black" and "white" may be used for the title), nothing else. To be able to do this, we use the <data> element in the <topicmeta> element of the main ditamap as follows:
[Codebox=] <data name="cover_graphic" value="path/to/image.jpg"
outputclass="white"/>[/Codebox]
At the moment, this only works if we have one entry in the <title> element of the main ditamap. Once we add <ph> elements within the title to allow different titles for pdf or html, using the deliveryTarget attribute, the title is invisible or shown in black. I've tried to solve this, but I'm running out of ideas now.
The XSLs that have been customized are front-matter.xsl, front-matter-attr.xsl and root-processing.xsl. The affected areas are:
In front-matter.xsl:
in front-matter-attr.xsl:
In root-processing.xsl:
In front-matter.xsl, I added the following condition as the first <xsl:when>:
However, this doesn't seem to do the trick. I assume, something else needs to be done, but I'm still an XSL beginner, so I hope that you can help me.
Thanks,
Chris
We are using a customized framework in oXygen, which means that instead of a front page, we have a cover page in our PDF outputs. This cover page integrates a graphic and a title in the color that the user specifies (only "black" and "white" may be used for the title), nothing else. To be able to do this, we use the <data> element in the <topicmeta> element of the main ditamap as follows:
[Codebox=] <data name="cover_graphic" value="path/to/image.jpg"
outputclass="white"/>[/Codebox]
At the moment, this only works if we have one entry in the <title> element of the main ditamap. Once we add <ph> elements within the title to allow different titles for pdf or html, using the deliveryTarget attribute, the title is invisible or shown in black. I've tried to solve this, but I'm running out of ideas now.
The XSLs that have been customized are front-matter.xsl, front-matter-attr.xsl and root-processing.xsl. The affected areas are:
In front-matter.xsl:
Code: Select all
<xsl:template name="createFrontCoverContents">
<!-- Added external graphic -->
<fo:block-container xsl:use-attribute-sets="cover_graphic_container">
<fo:block line-height="0mm" font-size="0mm">
<fo:external-graphic xsl:use-attribute-sets="cover_graphic">
<xsl:attribute name="src"
select="concat('url(Customization/OpenTopic/common/artwork/', $cover_graphic, ')')"/>
</fo:external-graphic>
</fo:block>
</fo:block-container>
<!-- Added if condition and changed attribute set -->
<xsl:if test="$languageDocType='individual'">
<fo:block xsl:use-attribute-sets="cover_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>
</xsl:if>
</xsl:template>
in front-matter-attr.xsl:
Code: Select all
<xsl:attribute-set name="cover_graphic">
<xsl:attribute name="content-height"><xsl:value-of select="$page-height"/></xsl:attribute>
<xsl:attribute name="line-height">0mm</xsl:attribute>
<xsl:attribute name="font-size">0mm</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="cover_title" use-attribute-sets="common.title">
<xsl:attribute name="color"><xsl:value-of select="$cover_text_color"/></xsl:attribute>
<xsl:attribute name="space-before">20mm</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:choose>
<xsl:when test="$PageFormat = 'A5'">14pt</xsl:when>
<xsl:otherwise>22pt</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="margin-right">10mm + <xsl:value-of select="$bleed"/></xsl:attribute>
</xsl:attribute-set>
Code: Select all
<xsl:variable name="cover_graphic"
select="(/*/opentopic:map//*[contains(@class, ' topic/data ')][@name = 'cover_graphic'])[1]/@value"/>
<xsl:variable name="cover_text_color"
select="(/*/opentopic:map//*[contains(@class, ' topic/data ')][@name = 'cover_graphic'])[1]/@outputclass"/>
Code: Select all
<xsl:when test="$map/title [contains(@class, 'topic/ph')]">
<xsl:apply-templates select="$map/title [contains(@class, 'topic/ph')]"/>
</xsl:when>
Thanks,
Chris