[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Trouble formatting PDF TOC entries
I should just like to add, in defence of the people who devote their time and energy to the docbkx-tools project, the issue is documented at https://code.google.com/p/docbkx-tools/wiki/FAQ - but sometimes you can’t see the wood for the trees. From: Janice Manwiller [mailto:janice@sqrrl.com] Sent: Tuesday, October 21, 2014 3:20 PM To: docbook-apps@lists.oasis-open.org Subject: Re: [docbook-apps] Trouble formatting PDF TOC entries FYI, with help from Nick Wood I was finally able to figure out what was wrong and get this to work. Passing along in case it helps someone else. The main problem was that I did not specify the DocBook 5 namespace. The namespace declaration was missing from the top of the custom stylesheet, and I didn't provide the namespace when specifying the items I wanted to customize. So the "when" needed to be: <xsl:when test="self::d:chapter | self::d:preface | self::d:appendix">bold</xsl:when> On Thu, Oct 16, 2014 at 1:18 PM, Barton Wright <ordinant@gmail.com> wrote: Hi Janice, Since some FO customizations do work and not others, the current issue has two probable causes: • The most likely cause is that there is a docbkx parameter setting, or worse, an undeclared _default_ parameter setting, that is overriding your custom TOC template. The docbcx documentation is atrocious in general, but is worse than atrocious in declaring what parameters they set for you. You can get a list of those by running Maven in debug mode, which emits far too much information. Among that info is a long list of every single DocBook XSL parameter that docbkx sets as it prepares to build the Webhelp, with the value assigned to each. I saved a copy of that list somewhere and will e-mail it to you privately. • An unlikely cause is the order in which your customized templates are read in your FO customization file. In the XSL, one XSL file calls another, which calls another, and so on, and all this happens in a certain well-defined order. Your custom templates _should_ always overlay and replace the default templates of the same name, but sometimes one customized template inadvertently overrides or cancels another in the same layer. Thus, sometimes rearranging the order of templates in your customization layer makes a difference. Best of luck, Barton Wright 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 <bobs@sagehill.net> 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 bobs@sagehill.net 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 <Nick.Wood@ncia.nato.int <mailto:Nick.Wood@ncia.nato.int>> 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:janice@sqrrl.com <mailto:janice@sqrrl.com>] *Sent:* Thursday, October 16, 2014 2:45 PM *To:* Fekete, Róbert *Cc:* Wood Nick; docbook-apps@lists.oasis-open.org <mailto:docbook-apps@lists.oasis-open.org> *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 <robert.fekete@balabit.com <mailto:robert.fekete@balabit.com>> 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 <janice@sqrrl.com <mailto:janice@sqrrl.com>> 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 <Nick.Wood@ncia.nato.int <mailto:Nick.Wood@ncia.nato.int>> wrote:____ Janice,____ ____ Try <*xsl:*choose/>.____ ____ Regards____ ____ Nick____ ____ *From:*Janice Manwiller [mailto:janice@sqrrl.com <mailto:janice@sqrrl.com>] *Sent:* Thursday, October 16, 2014 1:45 PM *To:* docbook-apps@lists.oasis-open.org <mailto:docbook-apps@lists.oasis-open.org> *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 -- Janice Manwiller Principal Technical Writer Sqrrl Data, Inc. www.sqrrl.com | @SqrrlData
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]