Justification of text in TOC (multi-line)

Here should go questions about transforming XML with XSLT and FOP.
josecotes
Posts: 19

Justification of text in TOC (multi-line)

Wed Jun 01, 2016 12:13 am

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: 318
Location: Craiova

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

Thu Jun 02, 2016 8:11 am

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: 19

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

Thu Jun 02, 2016 10:21 pm

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: 318
Location: Craiova

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

Fri Jun 03, 2016 8:47 am

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: 19

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

Fri Jun 03, 2016 9:01 pm

Hi there,

I modified the DITA-OT that comes with Oxygen.

Thanks,
radu_pisoi
Posts: 318
Location: Craiova

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

Mon Jun 06, 2016 2:50 pm

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: 19

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

Mon Jun 06, 2016 8:21 pm

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

Thanks!

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests