Justification of text in TOC (multi-line)

Here should go questions about transforming XML with XSLT and FOP.
josecotes
Posts: 23
Joined: Wed Nov 18, 2015 6:43 pm

Justification of text in TOC (multi-line)

Post by josecotes »

I have a problem I am not able to fix with the way the TOC entries are being justified when there is more than 1 line. Please see the graphics below. This is for PDF output, using a customized DITA-OT that I have develope based on the one that comes with Oxygen:

Image

Image

Any ideas on how I can fix this, so there is no "dead" space like the one in the 2 samples above?

Thanks,
radu_pisoi
Posts: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Justification of text in TOC (multi-line)

Post by radu_pisoi »

Hi,

You can fix this problem by setting the 'text-align' XSL-FO property to 'start' for TOC entries.

So, you need a PDF customization where you can specify the next attribute set:

Code: Select all

<xsl:attribute-set name="__toc__topic__content">
<xsl:attribute name="text-align">start</xsl:attribute>
</xsl:attribute-set>
If you don't have a PDF customization, you can read the next topics as a starting point:
http://oxygenxml.com/doc/versions/18.0/ ... ation.html
http://www.dita-ot.org/1.8/readme/dita2 ... ation.html
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
josecotes
Posts: 23
Joined: Wed Nov 18, 2015 6:43 pm

Re: Justification of text in TOC (multi-line)

Post by josecotes »

I have "text-align" already as start. But I believe that the problem might be that "text-align-last" is justify. But I need it to be justify. Any other clues? Here is my __toc__topic__content section:

Code: Select all

<xsl:attribute-set name="__toc__topic__content">
<xsl:attribute name="last-line-end-indent">-22pt</xsl:attribute>
<xsl:attribute name="end-indent">22pt</xsl:attribute>
<xsl:attribute name="text-indent">-<xsl:value-of select="$toc.text-indent"/></xsl:attribute>
<xsl:attribute name="text-align">start</xsl:attribute>
<xsl:attribute name="text-align-last">justify</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="$level = 2">14pt</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="font-weight">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="($level = 2) or ($level = 3) or ($level = 4)">normal</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="$level = 2">#094731</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="space-before">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="$level = 2">10pt</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="keep-together.within-page">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="($level = 4) or ($level = 5)">always</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-page">
<xsl:variable name="level" select="count(ancestor-or-self::*[contains(@class, ' topic/topic ')])"/>
<xsl:choose>
<xsl:when test="($level = 4) or ($level = 5)">always</xsl:when>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
radu_pisoi
Posts: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Justification of text in TOC (multi-line)

Post by radu_pisoi »

What DITA-OT you are using?

Did you modify the sources of DITA-OT to change the '__toc__topic__content' attribute set, or you use a PDF customization plugin or directory?
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
josecotes
Posts: 23
Joined: Wed Nov 18, 2015 6:43 pm

Re: Justification of text in TOC (multi-line)

Post by josecotes »

Hi there,

I modified the DITA-OT that comes with Oxygen.

Thanks,
radu_pisoi
Posts: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Justification of text in TOC (multi-line)

Post by radu_pisoi »

Please note that some properties from '__toc__topic__content' attribute set are overridden by the processor specific settings.

For DITA-OT 2.x, open the file:
{oXygenInstallDir}/frameworks/dita/DITA-OT2.x/plugins/org.dita.pdf2.fop/cfg/fo/attrs/toc-attr_fop.xsl

For DITA-OT 1.8, open the file:
{oXygenInstallDir}/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/cfg/fo/attrs/toc-attr_fop.xsl

If you don't have a customization folder, you have to modify these files too.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
josecotes
Posts: 23
Joined: Wed Nov 18, 2015 6:43 pm

Re: Justification of text in TOC (multi-line)

Post by josecotes »

Thanks a lot! You are right. toc-attr_fop.xsl was overwriting my settings.

Thanks!
Post Reply