This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: numbered Q&A entries how?
- From: Bob Stayton <bobs at caldera dot com>
- To: David Kilgour <towser1 at xtra dot co dot nz>, docbook at lists dot oasis-open dot org
- Date: Fri, 19 Jul 2002 01:30:57 -0700
- Subject: Re: DOCBOOK: numbered Q&A entries how?
- References: <3D3801B5.6DB55CAD@xtra.co.nz>
On Sat, Jul 20, 2002 at 12:10:29AM +1200, David Kilgour wrote:
> I would like my Q&A entries to be numbered:
>
> Q1
>
> A
>
> Q2
>
> A
>
> and for this numbering to continue across chapters. I would like to do
> this with both dsssl and xml docbook. Any suggestions welcome.
I can't say how to do this with DSSSL, and I assume
when you say "xml docbook" you mean the XSL stylesheets?
For XSL, if you are willing to forego all the options
for controlling the QandA labels and just want to hardwire
your style, then add these templates
to your XSL customization layer:
<xsl:template match="question" mode="label.markup">
<xsl:text>Q</xsl:text>
<xsl:number level="any" count="qandaentry" format="1"/>
</xsl:template>
<xsl:template match="answer" mode="label.markup">
<xsl:text>A</xsl:text>
</xsl:template>
The <xsl:number> with level="any" counts all instances of qandaentry
elements in your document, and doesn't reset.
But if you localize your doc (so 'Q' and 'A' might not
be appropriate), or want the option to change labeling
for a given qandaset, then you should copy the whole
template from common/labels.xsl:
<xsl:template match="question|answer" mode="label.markup">
to your customization layer and make similar changes.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
email: bobs@caldera.com