This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: [docbook-apps] indices (Was: Re: why does xsltproc create drafts from DocBook XML?)
- From: "David Cramer (Tech Pubs)" <dcramer at motive dot com>
- To: "Tom Peters" <tpeters at xs4all dot nl>,<docbook-apps at lists dot oasis-open dot org>
- Date: Fri, 30 Jan 2004 10:58:48 -0600
- Subject: RE: [docbook-apps] indices (Was: Re: why does xsltproc create drafts from DocBook XML?)
Correct, as-is that stylesheet can only be used as a preprocessing step. Jirka Kosek's profiling xsls (in the docbook xsls) demonstrate how to do multiple passes with one stylesheet and the Saxon xslt processor has a next-in-chain extension: http://saxon.sourceforge.net/saxon6.5.3/extensions.html#output, but having a separate step in a build script might be easiest and certainly would make debugging other stylesheet problems down the road easier.
Btw., I notice I put indent="yes" on the output element. Please change that to indent="no" to avoid having it mess up your verbatim environments (programlisting, screen).
David
> -----Original Message-----
> From: Tom Peters [mailto:tom@tompth.xs4all.nl]On Behalf Of Tom Peters
> Sent: Thursday, January 29, 2004 3:47 PM
> To: docbook-apps@lists.oasis-open.org
> Subject: Re: [docbook-apps] indices (Was: Re: why does xsltproc create
> drafts from DocBook XML?)
>
>
> This did not make it to the list, maybe because I added an attachment.
> I retry by including the stylesheet.
>
> ---------- Forwarded message ----------
> From: Tom Peters <tpeters@xs4all.nl>
> To: Dave Pawson <dpawson@nildram.co.uk>
> Cc: docbook-apps@lists.oasis-open.org
> Date: Sat, 17 Jan 2004 00:35:21 +0100 (CET)
> Subject: Re: [docbook-apps] indices (Was: Re: why does xsltproc create
> drafts from DocBook XML?)
>
> On Fri, 16 Jan 2004, Dave Pawson wrote:
>
> > At 20:48 14/01/2004, A.R. (Tom) Peters wrote:
> >
> >
> > >If I read you correctly, I have to mark-up (by some
> automized process or
> > >by hand) each occurrence of a word with <indexterm> in
> order to have it
> > >indexed.
> > >N.B.: the <indexterm> stanza is NOT rendered, you have to
> repeat it after
> > >the word itself.
> >
> > Yep. Real grunt work isn't it.
> > But note that a good pair of emacs macro's is a great help.
> > But it does produce a good index.
>
> To answer my own question: I had the same problem a year ago, and I
> believe it was David Cramer who sent me a stylesheet that appends an
> <indexterm> stanza after each relevant <glossterm> entry. At
> the time I
> was still using DSSSL so I didn't know what to do with it.
> Now I tried
> it, and it gives a very good first impression.
>
> I attach David's stylesheet. It works as a first run of xsltproc,
> producing an intermediate DocBook text that can be further
> processed by
> xsltprocw ith another stylesheet, and fop . I did not get it
> to work when
> included into a stylesheet that aims to produce the .fo file
> in one run.
>
>
> <?xml version="1.0"?>
>
> <!-- I made the default namespace null to avoid having Saxon
> put a saxon name space on the indexterm elements we're writing out -->
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns=""
> version="1.0">
>
> <xsl:output
> method="xml"
> indent="yes"/>
>
> <!-- By default, copy everything -->
> <xsl:template match="@*|node()">
> <xsl:copy>
> <xsl:apply-templates select="@*|node()"/>
> </xsl:copy>
> </xsl:template>
>
>
> <!-- For glossterms outside of the glossary, copy the
> element, but add an
> index marker immediately after it. UNLESS it's <glossterm role="no
> indexterm">; this gives the writer the ability to put in a
> glossterm and
> avoid having it create an indexterm marker. -->
> <xsl:template match="glossterm[not(ancestor::glossary) and
> not(@role = 'no indexterm')]">
> <xsl:copy-of
> select="."/><indexterm><primary><xsl:value-of
> select="."/></primary></indexterm>
> </xsl:template>
>
> <!-- This handles glossterms in the glossary as a special case -->
> <xsl:template match="glossentry">
> <glossentry>
> <xsl:copy-of select="@*"/>
> <xsl:copy-of select="glossterm"/>
> <xsl:copy-of select="acronym"/>
> <xsl:copy-of select="abbrev"/>
> <indexterm><primary><xsl:value-of
> select="glossterm"/></primary></indexterm>
> <xsl:copy-of select="revhistory"/>
> <xsl:copy-of select="glosssee"/>
> <xsl:copy-of select="glossdef"/>
> </glossentry>
> </xsl:template>
>
> </xsl:stylesheet>
>
> --
> #>!$!%(@^%#%*(&(#@#*$^@^$##*#@&(%)@**$!(&!^(#((#&%!)%*@)(&$($$
> %(@#)&*!^$)^@*^@)
>
> Tom "thriving on chaos" Peters
>
>
> To unsubscribe from this list, send a post to
> docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.