Re: [docbook-apps] Trouble formatting PDF TOC entries

From
Aaron DaMommio <>
Date
2014-10-16T17:03:46+00:00
ID
CAOm3+YxC67s7=
Thread
Re: [docbook-apps] Trouble formatting PDF TOC entries
Have you looked at whether, when you run under Maven, you're actually using a different processor than you think? Maven could change your starting context or paths.   You may be able to configure Maven to work like you expect.
--Aaron DaMommio

On Thu, Oct 16, 2014 at 11:56 AM, Janice Manwiller <> wrote:

Unfortunately not anytime soon, since it was chosen for easy integration with the product build.

I've been able to make several customizations in the FO XSL file that do work, so it seems to be a bit hit or miss.

On Thu, Oct 16, 2014 at 12:43 PM, Bob Stayton <> wrote:
Hi Janice,

Indeed, this behavior you see is strange.  When I copy your code into a basic customization layer and run it outside of Maven, it works properly.  I'm not sure what your reasons are for using Maven, but it seems to be getting in the way rather than helping.  Can you run the stylesheet outside of Maven using Saxon 6 or xsltproc?

Bob Stayton

Sagehill Enterprises



On 10/16/2014 6:29 AM, Janice Manwiller wrote:

Very strange....if the processing is ignoring toc.line.properties

completely, then why did I get the original error that xsl:choose was

required? Or is the validation of the XSL file separate from the actual

implementation?

On Thu, Oct 16, 2014 at 9:22 AM, Wood Nick <

<mailto:>> wrote:

    Hi Janice,____

    __ __

    Comparing your customization to mine, there is little difference,

    other than the addition of the chapter/appendix number prefixing the

    title, and nothing here appears to be in conflict.  My observation

    remains extant regarding the processing, if maven did not complain

    about the <choose> element in your first run, it tells me that the

    toc.line.properties customization is being ignored.____

    __ __

    Regards____

    __ __

    Nick____

    __ __

    *From:*Janice Manwiller [mailto:

    <mailto:>]

    *Sent:* Thursday, October 16, 2014 2:45 PM

    *To:* Fekete, Róbert

    *Cc:* Wood Nick; 

    <mailto:>

    *Subject:* Re: [docbook-apps] Trouble formatting PDF TOC entries____

    __ __

    It looks like the existing toc.line entry in the customization file

    does do some customization for appendices and chapters. Could that

    be interfering with the toc.line.properties attributes?____

    __ __

       <xsl:template name="toc.line">

         <xsl:param name="toc-context" select="NOTANODE"/>

         <xsl:variable name="id">

           <xsl:call-template name="object.id <http://object.id>"/>

         </xsl:variable>

         <xsl:variable name="label">

           <xsl:apply-templates select="." mode="label.markup"/>

         </xsl:variable>

         <fo:block xsl:use-attribute-sets="toc.line.properties">

           <fo:inline keep-with-next.within-line="always">

             <fo:basic-link internal-destination="{$id}">

               <xsl:if test="self::appendix or self::chapter">

                 <xsl:call-template name="gentext">

                   <xsl:with-param name="key" select="local-name()"/>

                 </xsl:call-template>

                 <xsl:text> </xsl:text>

               </xsl:if>

               <xsl:if test="$label != ''">

                 <xsl:copy-of select="$label"/>

                 <xsl:value-of select="$autotoc.label.separator"/>

               </xsl:if>

               <xsl:apply-templates select="." mode="titleabbrev.markup"/>

             </fo:basic-link>

           </fo:inline>

           <fo:inline keep-together.within-line="always">

             <xsl:text> </xsl:text>

             <fo:leader leader-pattern="dots"

               leader-pattern-width="3pt"

               leader-alignment="reference-area"

               keep-with-next.within-line="always"/>

             <xsl:text> </xsl:text>

             <fo:basic-link internal-destination="{$id}">

               <fo:page-number-citation ref-id="{$id}"/>

             </fo:basic-link>

           </fo:inline>

         </fo:block>

      </xsl:template>____

       <xsl:attribute-set name="toc.line.properties">

         <xsl:attribute name="font-size">10pt</xsl:attribute>

         <xsl:attribute name="font-weight">

           <xsl:choose>

             <xsl:when test="self::chapter | self::preface |

    self::appendix">bold</xsl:when>

             <xsl:otherwise>normal</xsl:otherwise>

           </xsl:choose>

         </xsl:attribute>

       </xsl:attribute-set>____

    __ __

    On Thu, Oct 16, 2014 at 8:25 AM, Fekete, Róbert

    < <mailto:>>

    wrote:____

    Hi,____

    __ __

    Your customization with Nick's correction should be working, that's

    what we also use. Do you have any other ToC-related customization

    that could interfere?____

    __ __

    Robert____

    __ __

    On Thu, Oct 16, 2014 at 2:07 PM, Janice Manwiller <

    <mailto:>> wrote:____

    Nope, that didn't do it. Still no bold for the chapter TOC entries.____

    __ __

    On Thu, Oct 16, 2014 at 7:57 AM, Wood Nick <

    <mailto:>> wrote:____

    Janice,____

    ____

    Try <*xsl:*choose/>.____

    ____

    Regards____

    ____

    Nick____

    ____

    *From:*Janice Manwiller [mailto:

    <mailto:>]

    *Sent:* Thursday, October 16, 2014 1:45 PM

    *To:* 

    <mailto:>

    *Subject:* [docbook-apps] Trouble formatting PDF TOC entries____

    ____

    I'm trying to update the formatting of a PDF TOC. I mostly want to

    add additional space above and bold the chapter entries.____

    ____

    I found the following sample for toc.line.properties in the DocBook

    XSL reference, and as a test added it to my FO stylesheet.____

    ____

    <xsl:attribute-set name="toc.line.properties">____

       <xsl:attribute name="font-size">10pt</xsl:attribute>____

       <xsl:attribute name="font-weight">____

         <xsl:when test="self::chapter | self::preface | self::appendix">bold</xsl:when>____

         <xsl:otherwise>normal</xsl:otherwise>____

       </xsl:attribute>____

    </xsl:attribute-set>____

    According to the guide, this should make all entries 10pt and

    chapter entries bold.____

    ____

    However, when I try to generate the DocBook output using our maven

    docbkx tool, it doesn't generate at all, and I get an error

    indicating that a "when" element must always be enclosed by a

    "choose" element.____

    ____

    If I add the choose element, like:____

    <xsl:attribute-set name="toc.line.properties">____

       <xsl:attribute name="font-size">10pt</xsl:attribute>____

       <xsl:attribute name="font-weight">____

        <choose>____

         <xsl:when test="self::chapter | self::preface | self::appendix">bold</xsl:when>____

         <xsl:otherwise>normal</xsl:otherwise>____

        </choose>____

       </xsl:attribute>____

    </xsl:attribute-set>____

    then the output generates, but there is no effect on the TOC

    formatting. The chapter entries aren't bold.____

    ____

    Any ideas on how to get this to work?____

    ____

    Thanks,____

    ____

    Janice____

    ____

    __ __

    -- ____

    Janice Manwiller____

    Principal Technical Writer____

    Sqrrl Data, Inc.____

    www.sqrrl.com <http://www.sqrrl.com> | @SqrrlData____

    __ __

    ____

    __ __

    -- ____

    Janice Manwiller____

    Principal Technical Writer____

    Sqrrl Data, Inc.____

    www.sqrrl.com <http://www.sqrrl.com> | @SqrrlData____

--

Janice Manwiller

Principal Technical Writer

Sqrrl Data, Inc.

www.sqrrl.com <http://www.sqrrl.com> | @SqrrlData

-- 

Janice Manwiller

Principal Technical Writer

Sqrrl Data, Inc.

www.sqrrl.com | @SqrrlData

-- 
--------------------------------------
Aaron DaMommio: Husband, father, writer, juggler, and expert washer of dishes.
- My blog: http://aarondamommio.blogspot.com
- Need a juggler?  http://amazingaaronjuggler.blogspot.com/
=======================================