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: [docbook] Automatically create index of commands


Bob Stayton <bobs@sco.com> writes:

> > > In any case I'm pretty sure I also want the index either on the
> > > same page or a second page, but not in the table of contents.  I
> > > guess it's time to start hitting the XSL file.

> > .. with which I've had a little bit of success.  But I'm still not
> > sure what the appropriate elements are to make the index with.  I
> > need a name and a short description, akin to refpurpose, that will
> > not be printed along with the 'main' cmdsynopsis.

> > indexterm doesn't look right...  I'm stumped.

> Ever since HTML started using "index.html" to mean a table of
> contents, I've been confused.  8^) Just to be perfectly clear here,
> when you say "index", you mean a listing of entries at the beginning
> of the section containing the entries?  Not a back-of-the-book
> index, right?

Correct.  I want a page that has a list of the commands at the top,
and then more detailed explanations below.  I managed to get what I
wanted by subverting the indexterm stuff, but it's sure not how it was
meant to be used.  I'm kind of embarassed to show the code, but it
does do the job:

  <xsl:template match="section/index">
    <ul>
      <xsl:for-each select="..//indexterm/primary">
	<li>
	  <span style="font-family:monospace; font-weight: bold;">
	    <a href="#{generate-id(key('primary',.))}">
	      <xsl:value-of select="."/>
	    </a>
	  </span>
	  <xsl:text> - </xsl:text>
	  <xsl:value-of select="../secondary"/>
	</li>
      </xsl:for-each>
    </ul>
  </xsl:template>

> If so, then you can do this with the HTML stylesheets out of the
> box.  The TOC mechanism has a lot of options, and I think it can
> meet your needs.

> Rewrite your entries from varlistentry to refentry as Bob
> sugggested.  That gives you the structure for name and purpose for
> each entry.  You can put a set of refentry elements in a sect1 or
> other section level, without putting them into a reference
> container.  What's missing is a section table of contents, which you
> need to turn on using this stylesheet parameter:

The other thing that is missing is the aggregation of all the
refentries on to one page.  From what I can make out in chunk.xsl, it
wants to make these individual pages - or am I mistaken?  Since my
commands don't have long descriptions, they don't warrant individual
pages at the moment.

> generate.section.toc.level=1  (if you use sect1)

I actually use 'section'.  Does that change things?

> This turns on a table of contents for sect1 level elements.  Of
> course, it will turn on the toc for all sect1 level elements, which
> you may not want.  There are ways to work around that if you are
> interested.

Yes, I suppose I would.

> The TOC for the section will include a line for each refentry
> element.  Since the 'annotate.toc' stylesheet parameter is set to 1
> by default, it will add the refpurpose to each TOC entry.

> Do you also want this for print output?  If so, you need to also
> modify the 'generate.toc' parameter to enable a toc for the
> appropriate section level.  Then the generate.section.toc.level can
> turn it on.

No printing so far, and I don't expect to bother with it anytime soon.

Thankyou very much for your time and answers!
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

To unsubscribe from this list, send a post to docbook-unsubscribe@lists.oasis-open.org.


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