Coloring the title on a cover page
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 152
- Joined: Fri Apr 24, 2015 12:28 pm
Coloring the title on a cover page
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
oXygen XML Editor 27.1 build 2025041508
DITA OT 3.7.4
DITA OT 3.7.4
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Coloring the title on a cover page
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
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
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 152
- Joined: Fri Apr 24, 2015 12:28 pm
Re: Coloring the title on a cover page
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
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 27.1 build 2025041508
DITA OT 3.7.4
DITA OT 3.7.4
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service