This is the mail archive of the 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: [docbook] Marking up exercices

On Mon, Oct 13, 2003 at 04:15:46PM +0200, Joachim Ziegler wrote:
> Hello list,
> What's the current state of the art in marking up exercises, exercise 
> sections and answers to exercises?
> I want to have sections with a title "Exercises" in which one ore more 
> exercices appear.
> The following features would be nice:
> - Exercise sections should not be numbered, not appear in the TOC, but 
> be allowed to appear at any level in the document.

Sounds like a bridgehead.
You can render them all in the same style by
using its renderas attribute consistently.

> - The exercises should be numbered throughout the whole document by the 
> stylesheets. (If that's not possible, then if an exercise within an 
> exercise section is the only one, it should not get number "1", because 
> that's obvious.)

You can number consecutively with a stylesheet customization
such as this:

<xsl:template match="question" mode="label.markup">
  <xsl:number level="any" count="qandaentry" format="1"/>

By setting level="any", it will consecutively count all
qandaentry elements in the entire document.

> - Answers to exercises should only be output in a "teacher's version" of 
> the document.

That would be conditional text (profiling), probably
using the 'userlevel' attribute on each answer element.
If you don't want to add such an attribute to every
answer element, then customize the stylesheet for answer
like this:

<xsl:template match="answer">
    <xsl:if test="$profile.userlevel = 'teacher'">

Then if you set the command line parameter
profile.userlevel to anything but 'teacher' then the
answers will disappear regardless of the profiling
attributes.  Fortunately, the answer element in a
qandaentry is optional, so you can filter it out for the
student manual.


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887

To unsubscribe from this list, send a post to, or visit

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