This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Select user-element inside <indexterm> in autoindex
- From: Bob Stayton <bobs at sco dot com>
- To: Mykone Saunders <mykone at i3dvr dot com>
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 12 Nov 2003 09:34:59 -0800
- Subject: Re: [docbook-apps] Select user-element inside <indexterm> in autoindex
- References: <20031111153004.VCZJ27041.tomts45-srv.bellnexxia.net@mykone>
On Tue, Nov 11, 2003 at 10:30:03AM -0500, Mykone Saunders wrote:
> Anybody know how to get specific tag to output in the AutoIndex?
>
> Example, I have the following user-defined element:
>
> <indexterm zone="intro">
> <primary>
> <translation>
> <english>Introduction</english>
> <french>Introductiones</english>
> </translation>
> </primary>
> </indexterm>
>
> What XSL customization would I had to print only the translation/french
> element as my index entry?
>
> Your assistance would be greatly appreciated. Thanks in advance.
Customizing the XSL indexterm templates is a serious challenge.
Those are among the most complex templates in the stylesheets.
But you can avoid that problem entirely.
Your file is a classic case of profiling, except you
are using your own tags. Here is a stylesheet that
does an identity transform, except that it maps your
custom language tags to standard phrase elements with
a lang attribute. Then you can use the profiling
stylesheet with the profile.lang stylesheet parameter
to process the result.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- convert language tags to phrase with lang attribute -->
<xsl:template match="translations">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="english">
<phrase lang="en">
<xsl:apply-templates/>
</phrase>
</xsl:template>
<xsl:template match="spanish">
<phrase lang="es">
<xsl:apply-templates/>
</phrase>
</xsl:template>
<xsl:template match="french">
<phrase lang="fr">
<xsl:apply-templates/>
</phrase>
</xsl:template>
</xsl:stylesheet>
Then the transformation is done in four steps
(maybe in a Makefile):
xsltproc \
-output mykone.tmp.xml \
the_above_stylesheet.xsl \
mykone.xml
xsltproc \
-output mykone.profiled.xml \
--stringparam profile.lang "es" \
../docbook-xsl-1.62.4/profiling/profile.xsl \
mykone.tmp.xml
xsltproc \
-output mykone.fo \
--stringparam fop.extensions 1 \
../docbook-xsl-1.62.4/fo/docbook.xsl \
mykone.profiled.xml
fop.sh mykone.fo mykone.pdf
It is a different approach, but a lot easier to
implement than customizing the index templates.
And it happens to work for all other elements in
your documents as well.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.