How to get two booktitlealt on two different lines in PDF output

Questions about XML that are not covered by the other forums should go here.
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

How to get two booktitlealt on two different lines in PDF output

Post by Sangeeta »

Hi,

I am working on a plugin with customized PDf styles. We have two booktitlealt in our DITAMap. In the PDF output, I want these booktitlealt on two different rows. However, in my output they are in one line without any space between them. Can you please help?
_____________________________________________________________________________________________________________________________
front-matter.xsl

Code: Select all


<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">
<fo:external-graphic src="url(Customization/OpenTopic/common/artwork/ptc_header.png)" width="100%" height="100%" content-width="scale-to-fit" content-height="scale-to-fit" scaling="uniform" />
</fo:block>
<!-- 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>

<!-- set the subtitle -->
<fo:block xsl:use-attribute-sets="__frontmatter__subtitle">
<xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/>

</fo:block>

</fo:block>
</fo:flow>
</fo:page-sequence>
<xsl:if test="not($retain-bookmap-order)">
<xsl:call-template name="createNotices"/>
</xsl:if>
</xsl:template>
___________________________________________________________________________________________________________________________
front-matter-aatr.xsl

Code: Select all


<xsl:attribute-set name="__frontmatter__title" use-attribute-sets="common.title">
<xsl:attribute name="space-before">3in</xsl:attribute>
<xsl:attribute name="space-before.conditionality">retain</xsl:attribute>
<xsl:attribute name="font-size">24pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="line-height">140%</xsl:attribute>
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="margin-left">2in</xsl:attribute>
<xsl:attribute name="color">#3D4647</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="__frontmatter__subtitle" use-attribute-sets="common.title">
<xsl:attribute name="font-size">14pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="line-height">140%</xsl:attribute>
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="color">#3D4647</xsl:attribute>
</xsl:attribute-set>
cosmin_andrei
Posts: 138
Joined: Mon Jun 12, 2017 10:50 am

Re: How to get two booktitlealt on two different lines in PDF output

Post by cosmin_andrei »

Hi Sangeeta,

I could not reproduce the issue you reported.
A DITA code such as:

Code: Select all


...
<booktitle>
<mainbooktitle>Main Book Title</mainbooktitle>
<booktitlealt>Alt Title 1</booktitlealt>
<booktitlealt>Alt Title 2</booktitlealt>
</booktitle>
...
transformed with the default DITA Map PDF transformation scenario produced a PDF output that looks like this:
files/AltTitle.jpg

This means that most likely the problem originates somewhere in your customization.
Regards,
Cosmin
--
Cosmin Andrei
oXygen XML Editor and Author Support
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Re: How to get two booktitlealt on two different lines in PDF output

Post by Sangeeta »

Hi Radu,

Can you please point me to the probable tags/elements where I should check in my customization? I have no clue what could have gone wrong :(
The code i sent you is only piece i customized for titles.

Best regards,
Sangeeta
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Re: How to get two booktitlealt on two different lines in PDF output

Post by Sangeeta »

My bad Cosmin :(, got the wrong name
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to get two booktitlealt on two different lines in PDF output

Post by Radu »

Hi,

Maybe if the DITA Map contains multiple booktitlealt's your XSLT customization instead of doing this:

Code: Select all

        <fo:block xsl:use-attribute-sets="__frontmatter__subtitle">
<xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/>
</fo:block>
you could add a fo:block for each booktitlealt:

Code: Select all

        <xsl:for-each select="$map//*[contains(@class,' bookmap/booktitlealt ')]">
<fo:block xsl:use-attribute-sets="__frontmatter__subtitle">
<xsl:apply-templates select="."/>
</fo:block>
</xsl:for-each>
although in the base PDF plugin "front-matter.xsl" there should already be a template which matches the booktitlealt and creates a fo:block:

Code: Select all

    <xsl:template match="*[contains(@class, ' bookmap/booktitlealt ')]" priority="2">
<fo:block xsl:use-attribute-sets="__frontmatter__subtitle">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Re: How to get two booktitlealt on two different lines in PDF output

Post by Sangeeta »

Hi Radu,

Thank you so so much! Worked like magic :D ...
SO in the template with "select", we are reapplying the subtitle style to booktitlealt elements?

Best regards,
Sangeeta
Post Reply