|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Table numbering with docbook 1.74.3 on PDF and HTML report.Hi,
I am using docbook version 1.74.3.
Currently I am getting table number on my HTML/PDF report as (ChapterNumber).1, (ChapterNumber).2, (ChapterNumber).3 ... and so on
For example: I have "Chapter 2" and under it I have section number 2.3.2. Following is how table numbers are listed curently on my HTML report (table 2.1, table 2.3 and table 2.3).
Chapter 2
2.3.2 Report Trees
Table 2.1 Dec1Tree
Table 2.2 Dec2Tree
Table 2.3 Dec3Tree
I want the table numbers starting with the section number above it instead on starting with the Chapter number above it.
For example: I want the Table number as (Table 2.3.2.1, Table 2.3.2.2 and Table 2.3.2.3) shown below.
Chapter 2 |
||||||||||||
|
|
Re: 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.
|
||||||||||||
|
|
|
|
Data Type |
Length |
|
Numeric |
3 |
Table 2.2 Dec2Tree
|
Data Type |
Length |
|
Numeric |
3 |
Table 2.3 Dec3Tree
|
Data Type |
Length |
|
Numeric |
3 |
| Free embeddable forum powered by Nabble | Forum Help |