[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Table numbering with docbook 1.74.3 on PDF and HTML report.
Hi,
The number labels are generated by applying
templates to the table element in mode="label.markup". The default
template is in common/labels.xsl and works for table, figure, and
example:
<xsl:template match="figure|table|example"
mode="label.markup">
<xsl:variable name="pchap" select="ancestor::chapter |ancestor::appendix |ancestor::article[ancestor::book]"/> <xsl:variable
name="prefix">
<xsl:if test="count($pchap) > 0"> <xsl:apply-templates select="$pchap" mode="label.markup"/> </xsl:if> </xsl:variable> <xsl:choose>
<xsl:when test="@label"> <xsl:value-of select="@label"/> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$prefix != ''"> <xsl:apply-templates select="$pchap" mode="label.markup"/> <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/> <xsl:number format="1" from="chapter|appendix" level="any"/> </xsl:when> <xsl:otherwise> <xsl:number format="1" from="book|article" level="any"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> You can copy this to your customization layer and
change it to match="table" to only affect tables. Then a couple more
changes are needed.
The variable "pchap" is the ancestor
element whose number label becomes the prefix for the table number. Change
the variable pchap selection to "ancestor::section". And then change the
first xsl:number so the "from" attribute is "section" instead of
"chapter|appendix", so that the table numbering restarts in each section. That
should do it.
You might need to make further improvements to
handle the case of a table contained in a chapter before the first section,
though.
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]