Jeff Hooker | 2 Aug 2012 20:07

Processing titles for the PDF TOC

Hi all,

I'm using docbook-xsl-1.73.2 and Saxon 9 HE to generate PDFs via XEP.

I'm attempting to strip any "remark" elements that authors have embedded
in "title" elements from the content reproduced in the TOC. As far as I
can tell, simply adding 

    <xsl:template match="remark" mode="titleabbrev.markup"/>

should have done the trick, but it hasn't. In fact, none of  

    <xsl:template match="remark" mode="label.markup"/>
    <xsl:template match="remark" mode="toc"/>

has made any kind of impression, which is puzzling. 

From what I can see, the processing for the titles found in the TOC is
done via the toc.line template, which generates the title content via
<xsl:apply-templates select="." mode="titleabbrev.markup"/>, so
<xsl:template match="remark" mode="titleabbrev.markup"/> should prevent
remarks from being processed. I can see nothing in the scripts to
override it, yet the continuing presence of the remark elements in my
output says otherwise.

Suggestions?
Jeff.
Thomas Schraitle | 2 Aug 2012 21:34
Picon

Re: Processing titles for the PDF TOC

Hi Jeff,

Am Donnerstag, 2. August 2012, 11:07:42 schrieb Jeff Hooker:
> I'm using docbook-xsl-1.73.2 and Saxon 9 HE to generate PDFs via XEP.

This a rather old version. Have you considered to update to the latest 
version?

 
> I'm attempting to strip any "remark" elements that authors have embedded
> in "title" elements from the content reproduced in the TOC. 
> [...]
> 
> Suggestions?

Why do you customize templates? If I'm not mistaken, you don't have to. 

There is the parameter show.comments[1] which is set to 1 by default. That 
means, any comment written as remark will be displayed. To suppress your 
remarks, set show.comments to 0 (zero).

See also my short article about remarks[2].

I would have expected that this mechanism works also in titles. If not, I 
would consider it as a bug.

---- References
[1] 
http://docbook.sourceforge.net/release/xsl/current/doc/html/show.comments.html
[2] http://doccookbook.sourceforge.net/html/en/dbc.markup.remarks.html
(Continue reading)

Bob Stayton | 2 Aug 2012 21:39

Re: Processing titles for the PDF TOC

Hi Jeff,
I presume you want the remark to show in the title in the body of the document, just 
not in the TOC.

Your template doesn't work because the stylesheet does not stay in 
mode="titleabbrev.markup" to process the title.  It uses that mode to select 
titleabbrev if it exists and then falls back to title if it does not.  But whichever 
it selects, it processes it in mode="title.markup".    See this template in 
common/titles.xsl:

<xsl:template match="*" mode="titleabbrev.markup">
  <xsl:param name="allow-anchors" select="0"/>
  <xsl:param name="verbose" select="1"/>

  <xsl:choose>
    <xsl:when test="titleabbrev">
      <xsl:apply-templates select="titleabbrev[1]" mode="title.markup">
        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
      </xsl:apply-templates>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="." mode="title.markup">
        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
        <xsl:with-param name="verbose" select="$verbose"/>
      </xsl:apply-templates>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

And then in title.markup mode, it also does not stay in that mode:
(Continue reading)


Gmane