Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > 9f452694b2d23dacae7f9cc757f9be50 > files > 250

docbook-style-xsl-1.78.1-1.fc17.noarch.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>make.index.markup</title><link rel="stylesheet" type="text/css" href="../reference.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: Reference Documentation"><link rel="up" href="toc_index.html" title="ToC/LoT/Index Generation"><link rel="prev" href="generate.index.html" title="generate.index"><link rel="next" href="index.method.html" title="index.method"><link rel="copyright" href="copyright.html" title="License"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">make.index.markup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generate.index.html">Prev</a> </td><th width="60%" align="center">ToC/LoT/Index Generation</th><td width="20%" align="right"> <a accesskey="n" href="index.method.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="make.index.markup"></a><div class="titlepage"></div>

<div class="refnamediv"><h2><span class="refentrytitle">make.index.markup</span></h2><p>
make.index.markup
 &#8212; Generate XML index markup in the index?
</p></div>

<div class="refsynopsisdiv"><h2>Synopsis</h2>
<a name="make.index.markup.frag"></a><pre class="programlisting">
&lt;xsl:param name="make.index.markup" select="0"&gt;&lt;/xsl:param&gt;
</pre>
</div>

<div class="refsection"><a name="idp3526224"></a><h2>Description</h2>

<p>This parameter enables a very neat trick for getting properly
merged, collated back-of-the-book indexes. G. Ken Holman suggested
this trick at Extreme Markup Languages 2002 and I'm indebted to him
for it.</p>

<p>Jeni Tennison's excellent code in
<code class="filename">autoidx.xsl</code> does a great job of merging and
sorting <a href="http://docbook.org/tdg5/en/html/indexterm.html"><code class="sgmltag-element">indexterm</code></a>s in the document and building a
back-of-the-book index. However, there's one thing that it cannot
reasonably be expected to do: merge page numbers into ranges. (I would
not have thought that it could collate and suppress duplicate page
numbers, but in fact it appears to manage that task somehow.)</p>

<p>Ken's trick is to produce a document in which the index at the
back of the book is <span class="quote">&#8220;<span class="quote">displayed</span>&#8221;</span> in XML. Because the index
is generated by the FO processor, all of the page numbers have been resolved.
It's a bit hard to explain, but what it boils down to is that instead of having
an index at the back of the book that looks like this:</p>

<div class="blockquote"><blockquote class="blockquote">
<p><b>A. </b>
ap1, 1, 2, 3
</p>
</blockquote></div>

<p>you get one that looks like this:</p>

<div class="blockquote"><blockquote class="blockquote">
<pre class="programlisting">&lt;indexdiv&gt;A&lt;/indexdiv&gt;
&lt;indexentry&gt;
&lt;primaryie&gt;ap1&lt;/primaryie&gt;,
&lt;phrase role="pageno"&gt;1&lt;/phrase&gt;,
&lt;phrase role="pageno"&gt;2&lt;/phrase&gt;,
&lt;phrase role="pageno"&gt;3&lt;/phrase&gt;
&lt;/indexentry&gt;</pre>
</blockquote></div>

<p>After building a PDF file with this sort of odd-looking index, you can
extract the text from the PDF file and the result is a proper index expressed in
XML.</p>

<p>Now you have data that's amenable to processing and a simple Perl script
(such as <code class="filename">fo/pdf2index</code>) can
merge page ranges and generate a proper index.</p>

<p>Finally, reformat your original document using this literal index instead of
an automatically generated one and <span class="quote">&#8220;<span class="quote">bingo</span>&#8221;</span>!</p>

</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="generate.index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="toc_index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="index.method.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">generate.index </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> index.method</td></tr></table></div></body></html>