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


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-apps] Font familiy of some automatically generated index-entries


----- Original Message ----- 
From: "Joachim Ziegler" <ziegler@mpi-sb.mpg.de>
To: "Bob Stayton" <bobs@sagehill.net>
Cc: "docbook-apps" <docbook-apps@lists.oasis-open.org>
Sent: Friday, February 06, 2004 5:53 AM
Subject: Re: [docbook-apps] Font familiy of some automatically generated
index-entries


> Bob Stayton wrote:
> > If you look in fo/autoidx.xsl, the stylesheet module that handles
> > indexterms,
> > you will find this line:
> >
> > <xsl:value-of select="primary"/>
> >
> > Taking the value of an element returns just the text content of the
element,
> > including those of its decendent elements.  I suspect this was done on
> > purpose to give the index a consistent look and to avoid complications
> > that might arise when elements are formatted. There are
> > elements that are allowed inside <primary> that would break the
formatting
> > of an index.  For example, revhistory is allowed, but it generates a
table.
> >
> > If you want to change that behavior, you will need to customize several
> > templates in fo/autoidx.xsl. For example, replace the above line with:
> >
> > <xsl:apply-templates select="primary/child::node()"/>
>
> Thank you, this works fine, but there is one problem left that sometimes
> occurs:
>
> Imagine that in your document you first talk about stacks as a
> datastructure in general and later you talk about a (C++, Java,...)
> implementation "class stack". So you have two indexterms
>
> <indexterm><primary>stack</primary></indexterm>
> .
> .
> .
> <indexterm><primary><classname>stack</classname></primary></indexterm>
>
> There should be twe separate index entries, one for stack in general
> (proportional font), and one for the class stack (fixed font) so that
> the reader can quickly distinguish between them. Many books do it this
> way, e.g. Stroustrup (from which I've taken this stack example.)
>
> But the XSLT stylesheets map both indexterms to one entry.
>
> Is there any way to workaround this?

I thought this was going to be really hard, because the indexing
machinery is so complex and difficult to follow.

But actually, you can accomplish this without customizing the
stylesheet at all.  You can do it entirely in your source document.
The sortas attribute can be used to separate them:

<indexterm><primary>stack</primary></indexterm>
<indexterm><primary sortas="stack classname">
     <classname>stack</classname></primary></indexterm>

If all the instances of the classname indexterm have a sortas attribute
that differs from the non-classname indexterms, then they will be treated
as different index entries.  You'll have to be careful to get them to sort
together if you have other "stack somethings".  You'll have to come
up with a naming scheme, maybe using a character that occurs
before all letters in the sort order.

Combined with the earlier customization, you should get what you want.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net



To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


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