[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] indices (Was: Re: why does xsltproc create draftsfrom 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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]