This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: numbered Q&A entries how?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]