Coloring the title on a cover page

Post here questions and problems related to editing and publishing DITA content.
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Coloring the title on a cover page

Post by ckabstein »

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:

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>
In root-processing.xsl:

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"/>
In front-matter.xsl, I added the following condition as the first <xsl:when>:

Code: Select all

<xsl:when test="$map/title [contains(@class, 'topic/ph')]">
<xsl:apply-templates select="$map/title [contains(@class, 'topic/ph')]"/>
</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
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Coloring the title on a cover page

Post by Radu »

Hi Chris,

In such cases you can set the publishing parameter "clean.temp" to "no", publish and after publishing look in the transformation temporary files folder for a file called "topic.fo". It is the XSL-FO file created by the XSLT processing which you have customized.
Open the file in Oxygen, format and indent it and try to find the particular place where your customization should have set the cover_title color.
In my opinion your customization probably properly sets the cover_title color to the fo:block but inside that block, for each <ph> element which was defined in the title there is an fo:inline which has the default color specified on it.

If you cannot find a solution for this you can send us the PDF customization (support@oxygenxml.com) and we can try to take a look at it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: Coloring the title on a cover page

Post by ckabstein »

Hi Radu,

Thanks for your help. The fo:inline element indeed uses the standard color. The fo:block shows the specified color. I've tried to insert or change the fo:inline element somehow by trial and error, but I have failed so often now that I don't see any other choice than to ask for your help again.

Will send you the custom files on Monday.

Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
Post Reply