OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Sequential table numbering (as opposed to hierarchical) ?


On 7/13/07, Johnson Earls <darkfoxprime@yahoo.com> wrote:
>     I'm using DocBook v4.5, and the docbook-xsl 1.72.0 XSL stylesheets.
>  What I'd like to do is make it so my tables (and figures, etc.) are
> numbered sequentially through the entire Book, instead of being
> numbered per-chapter.  Is this something simple that I'm just missing?

Hi Johnson,

There are a few factors that influence the way figures, tables, and
examples are numbered ("labeled"), one of which is the labeling of the
chapters and parts above them (described in [1]). The second, which
takes precedence by default, is a @label attribute on the figure,
example, or table [2]. This @label will be preserved verbatim if it
exists. However, that's not a very dynamic way to generate numbering
and creates unnecessary work.

You asked specifically about sequential figure and table numbering, so
here's how you'd set up a customization layer[3] (you can't do it
using only parameters, I think), if you haven't already. Inside that,
override the template matching figures, tables, and examples in the
label.markup mode. The template you're overriding is in
common/labels.xsl. I'd customize it to look like so:

<xsl:template match="figure|table|example" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:number format="1" from="book|article" level="any"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Please note: This'll still allow you to override the autonumbering
with a @label.

This should work on all the output types that have numbered figures,
tables, and examples.

HTH,
Keith

1. http://www.sagehill.net/docbookxsl/SectionNumbering.html
2. http://www.docbook.org/tdg/en/html/figure.html
"    Label specifies an identifying string for presentation purposes.

    Generally, an explicit Label attribute is used only if the
processing system is incapable of generating the label automatically.
If present, the Label is normative; it will used even if the
processing system is capable of automatic labelling. "
3. http://www.sagehill.net/docbookxsl/CustomMethods.html


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]